From 2033236e4f17d8c413a9588a0f839c0b312ed470 Mon Sep 17 00:00:00 2001 From: Denis Kuzmin Date: Thu, 19 Sep 2019 19:53:28 +0300 Subject: [PATCH] Series of new projects by reason of independent script engines and MIT (#56) * Draft versions Varhead and LSender projects (netstd2.0 + net40). Part of #55 Updated tests. Also PascalCasing due to crazy .net convention, ie. IDE1006 * Draft of the E-MSBuild project (netstd2.0 + net40). Part of #55 * Reimplemented fixes for "Save changes to " through new VaLier * Draft of SobaScript project. /Core (netstd2.0 + net40). Part of #55 components still are part of vssbe * Fixed unlooping mechanism because of disabled parsing for some data * Final draft of SobaScript, Mapper, Z.Core, Z.Ext, Z.VS /part of #55 * Recovered missing files * fixed CI build * Fixed vsix 7z x64 folder and NuGetComponent use of GetNuTool * CIM __vssbe_diag flag to enable diagnostic mode * Removed src: E-MSBuild, SobaScript, Varhead, Mapper, LSender, Z.Core, Z.Ext, Z.VS +their tests * +submodules SobaScript, E-MSBuild, ... * Fixed "Method in type from assembly does not have an implementation" also reverts old order SDK10 -> SDK15 * Fixes debug mode init and updates NuGetComponent --- .gitmodules | 15 + .gnt/packages.config | 2 +- .vssbe | 34 +- CI.MSBuild/EventManager.cs | 4 + CI.MSBuild/Initializer.cs | 2 +- CI.MSBuild/Log.cs | 11 +- E-MSBuild | 1 + SobaScript | 1 + SobaScript.Z.Core | 1 + SobaScript.Z.Ext | 1 + SobaScript.Z.VS | 1 + VsixLib.targets | 10 +- build.bat | 9 +- packages.cmd | 3 +- submodules.bat | 47 - vsSolutionBuildEvent.sln | 943 +++++++++++- vsSolutionBuildEvent/API/EventLevel.cs | 97 +- vsSolutionBuildEvent/API/IEventLevel.cs | 9 +- vsSolutionBuildEvent/Actions/Action.cs | 39 +- vsSolutionBuildEvent/Actions/ActionCSharp.cs | 39 +- .../Actions/ActionInterpreter.cs | 5 +- vsSolutionBuildEvent/Actions/ActionTargets.cs | 64 +- .../Actions/{Connection.cs => Binder.cs} | 37 +- vsSolutionBuildEvent/Actions/Command.cs | 12 +- vsSolutionBuildEvent/Actions/DTEOperation.cs | 43 +- vsSolutionBuildEvent/Actions/HProcess.cs | 330 ----- vsSolutionBuildEvent/Actions/ICommand.cs | 8 +- vsSolutionBuildEvent/Bootloader.cs | 132 ++ vsSolutionBuildEvent/BuildEnv.cs | 110 ++ vsSolutionBuildEvent/Clients/ClientLibrary.cs | 3 +- vsSolutionBuildEvent/Config.cs | 9 +- .../Configuration/User/Manager.cs | 15 +- vsSolutionBuildEvent/DteEnv.cs | 128 ++ vsSolutionBuildEvent/EncDetector.cs | 104 ++ vsSolutionBuildEvent/EnvAbstract.cs | 12 +- vsSolutionBuildEvent/Environment.cs | 14 +- .../Exceptions/CompilerException.cs | 14 +- .../Exceptions/ComponentException.cs | 49 - .../Exceptions/IncorrectSyntaxException.cs | 37 - .../Exceptions/InvalidArgumentException.cs | 37 - .../Exceptions/LimitException.cs | 37 - .../Exceptions/MismatchException.cs | 37 - .../Exceptions/NotFoundException.cs | 37 - ...{SBEException.cs => UnspecSBEException.cs} | 36 +- .../Extensions/ArrayExtension.cs | 23 - .../Extensions/ObjectExtension.cs | 13 - .../Extensions/StringExtension.cs | 10 - vsSolutionBuildEvent/IAppSettings.cs | 7 +- vsSolutionBuildEvent/IEnvironment.cs | 3 +- vsSolutionBuildEvent/ILogData.cs | 30 - vsSolutionBuildEvent/IsolatedEnv.cs | 14 +- vsSolutionBuildEvent/Log.cs | 4 +- vsSolutionBuildEvent/Logger/Initializer.cs | 22 +- vsSolutionBuildEvent/MSBuild.cs | 50 + .../Exceptions/MSBProjectNotFoundException.cs | 38 - .../MSBPropertyNotFoundException.cs | 38 - .../Exceptions/MSBPropertyParseException.cs | 38 - .../Exceptions/PossibleLoopException.cs | 43 - vsSolutionBuildEvent/MSBuild/IMSBuild.cs | 90 -- vsSolutionBuildEvent/MSBuild/Parser.cs | 841 ----------- vsSolutionBuildEvent/MSBuild/PreparedData.cs | 151 -- vsSolutionBuildEvent/MSBuild/PropertyItem.cs | 34 - vsSolutionBuildEvent/MSBuild/RPattern.cs | 289 ---- vsSolutionBuildEvent/MSBuild/StringHandler.cs | 61 - vsSolutionBuildEvent/MainToolCommand.cs | 2 +- vsSolutionBuildEvent/OwpEnv.cs | 155 ++ vsSolutionBuildEvent/Pkg.cs | 12 +- .../Properties/AssemblyInfo.cs | 12 +- vsSolutionBuildEvent/Receiver/Output/Items.cs | 5 +- vsSolutionBuildEvent/SBEScripts/Bootloader.cs | 191 --- vsSolutionBuildEvent/SBEScripts/CValueType.cs | 77 - .../SBEScripts/Components/BoxComponent.cs | 475 ------ .../Components/Build/ProjectsMap.cs | 277 ---- .../SBEScripts/Components/BuildComponent.cs | 409 ------ .../SBEScripts/Components/CommentComponent.cs | 70 - .../SBEScripts/Components/Component.cs | 208 --- .../Components/Condition/Expression.cs | 321 ---- .../Components/ConditionComponent.cs | 161 --- .../SBEScripts/Components/DTEComponent.cs | 232 --- .../SBEScripts/Components/FileComponent.cs | 1285 ----------------- .../Components/FunctionComponent.cs | 120 -- .../SBEScripts/Components/IComponent.cs | 61 - .../SBEScripts/Components/MSBuildComponent.cs | 71 - .../Components/NuGet/GetNuTool/Core.cs | 286 ---- .../Components/NuGet/GetNuTool/GNT.cs | 118 -- .../SBEScripts/Components/NuGetComponent.cs | 123 -- .../SBEScripts/Components/OWPComponent.cs | 481 ------ .../Components/SevenZipComponent.cs | 747 ---------- .../SBEScripts/Components/TryComponent.cs | 189 --- .../Components/UserVariableComponent.cs | 206 --- .../SBEScripts/Dom/CompletionData.cs | 193 --- .../SBEScripts/Dom/ComponentAttribute.cs | 99 -- .../SBEScripts/Dom/DefinitionAttribute.cs | 70 - .../SBEScripts/Dom/DomParser.cs | 363 ----- .../SBEScripts/Dom/IAttrDomLevelA.cs | 37 - .../SBEScripts/Dom/IAttrDomLevelB.cs | 32 - .../SBEScripts/Dom/IInspector.cs | 52 - .../SBEScripts/Dom/INodeInfo.cs | 58 - .../SBEScripts/Dom/InfoType.cs | 60 - .../SBEScripts/Dom/Inspector.cs | 314 ---- .../SBEScripts/Dom/MethodAttribute.cs | 202 --- .../SBEScripts/Dom/NodeIdent.cs | 55 - .../SBEScripts/Dom/NodeInfo.cs | 241 ---- .../SBEScripts/Dom/PropertyAttribute.cs | 127 -- .../Exceptions/ArgumentPMException.cs | 47 - .../Exceptions/IncorrectNodeException.cs | 58 - .../NotSupportedOperationException.cs | 37 - .../Exceptions/OperandNotFoundException.cs | 38 - .../Exceptions/OperationNotFoundException.cs | 38 - .../SBEScripts/Exceptions/ScriptException.cs | 38 - .../Exceptions/SelectorMismatchException.cs | 37 - .../Exceptions/SubtypeNotFoundException.cs | 37 - .../Exceptions/SyntaxIncorrectException.cs | 37 - .../SBEScripts/IBootloader.cs | 82 -- vsSolutionBuildEvent/SBEScripts/ISBEScript.cs | 44 - vsSolutionBuildEvent/SBEScripts/RPattern.cs | 306 ---- .../SBEScripts/SNode/Argument.cs | 32 - .../SBEScripts/SNode/ArgumentType.cs | 91 -- .../SBEScripts/SNode/EvalType.cs | 47 - .../SBEScripts/SNode/ILevel.cs | 61 - vsSolutionBuildEvent/SBEScripts/SNode/IPM.cs | 179 --- .../SBEScripts/SNode/Level.cs | 98 -- .../SBEScripts/SNode/LevelType.cs | 51 - vsSolutionBuildEvent/SBEScripts/SNode/PM.cs | 639 -------- vsSolutionBuildEvent/SBEScripts/Script.cs | 254 ---- .../SBEScripts/StringHandler.cs | 144 -- vsSolutionBuildEvent/SBEScripts/Value.cs | 349 ----- .../Scripts/EvaluatorBlank.cs | 32 - vsSolutionBuildEvent/Scripts/IEvaluator.cs | 32 - vsSolutionBuildEvent/Scripts/IUserVariable.cs | 146 -- .../Scripts/IUserVariableDebug.cs | 32 - .../Scripts/StringProtector.cs | 286 ---- vsSolutionBuildEvent/Scripts/TUserVariable.cs | 100 -- vsSolutionBuildEvent/Scripts/Tokens.cs | 98 -- vsSolutionBuildEvent/Scripts/UserVariable.cs | 358 ----- vsSolutionBuildEvent/Settings.cs | 23 +- .../Components/InternalComponent.cs | 229 ++- vsSolutionBuildEvent/SolutionEvents.cs | 3 +- vsSolutionBuildEvent/SzArchiver.cs | 167 +++ .../UI/WForms/Controls/CompletionData.cs | 194 +++ .../WForms/Controls/DomIcon.Designer.cs} | 12 +- .../WForms/Controls/DomIcon.resx} | 10 +- .../UI/WForms/Controls/TextEditor.cs | 33 +- .../UI/WForms/EnvDteSniffer.cs | 4 +- vsSolutionBuildEvent/UI/WForms/EventsFrm.cs | 41 +- .../UI/WForms/Logic/Events.cs | 46 +- .../UI/WForms/PropertiesFrm.cs | 16 +- .../UI/WForms/PropertyCheckFrm.cs | 7 +- .../UI/WForms/ScriptCheckFrm.cs | 57 +- .../UI/WForms/Wizards/Version/Manager.cs | 6 +- .../UI/WForms/Wizards/Version/StepFinal.cs | 11 +- .../UI/WForms/Wizards/Version/StepStruct.cs | 5 +- .../UI/WForms/Wizards/VersionFrm.cs | 22 +- vsSolutionBuildEvent/UserConfig.cs | 2 +- vsSolutionBuildEvent/packages.config | 1 + .../vsSolutionBuildEvent.csproj | 176 ++- .../Actions/DTEOperationTest.cs | 73 +- .../MSBuild/ParserTest.cs | 1230 +--------------- .../Properties/AssemblyInfo.cs | 1 - .../SBEScripts/Components/BoxComponentTest.cs | 333 ----- .../Components/BuildComponentTest.cs | 564 -------- .../Components/CommentComponentTest.cs | 97 -- .../Components/ConditionComponentTest.cs | 492 ------- .../SBEScripts/Components/DTEComponentTest.cs | 265 ---- .../Components/FileComponentTest.cs | 899 ------------ .../Components/FunctionComponentTest.cs | 194 --- .../Components/InternalComponentTest.cs | 329 ----- .../Components/MSBuildComponentTest.cs | 90 -- .../Components/NuGetComponentTest.cs | 73 - .../SBEScripts/Components/OWPComponentTest.cs | 388 ----- .../Components/SevenZipComponentTest.cs | 476 ------ .../SBEScripts/Components/TryComponentTest.cs | 189 --- .../Components/UserVariableComponentTest.cs | 198 --- .../SBEScripts/RPatternTest.cs | 361 ----- .../SBEScripts/SNode/LevelTest.cs | 133 -- .../SBEScripts/SNode/PMTest.cs | 1001 ------------- .../SBEScripts/ScriptTest.cs | 374 ----- .../SBEScripts/StringHandlerTest.cs | 83 -- .../SBEScripts/ValueTest.cs | 531 ------- .../Scripts/UserVariableTest.cs | 451 ------ vsSolutionBuildEventTest/SobaAcs.cs | 20 + .../Components/InternalComponentTest.cs | 271 ++++ vsSolutionBuildEventTest/TempFile.cs | 2 +- vsSolutionBuildEventTest/key.snk | Bin 0 -> 596 bytes vsSolutionBuildEventTest/packages.config | 1 + .../vsSolutionBuildEventTest.csproj | 73 +- 186 files changed, 3090 insertions(+), 23570 deletions(-) create mode 160000 E-MSBuild create mode 160000 SobaScript create mode 160000 SobaScript.Z.Core create mode 160000 SobaScript.Z.Ext create mode 160000 SobaScript.Z.VS delete mode 100644 submodules.bat rename vsSolutionBuildEvent/Actions/{Connection.cs => Binder.cs} (97%) delete mode 100644 vsSolutionBuildEvent/Actions/HProcess.cs create mode 100644 vsSolutionBuildEvent/Bootloader.cs create mode 100644 vsSolutionBuildEvent/BuildEnv.cs create mode 100644 vsSolutionBuildEvent/DteEnv.cs create mode 100644 vsSolutionBuildEvent/EncDetector.cs delete mode 100644 vsSolutionBuildEvent/Exceptions/ComponentException.cs delete mode 100644 vsSolutionBuildEvent/Exceptions/IncorrectSyntaxException.cs delete mode 100644 vsSolutionBuildEvent/Exceptions/InvalidArgumentException.cs delete mode 100644 vsSolutionBuildEvent/Exceptions/LimitException.cs delete mode 100644 vsSolutionBuildEvent/Exceptions/MismatchException.cs delete mode 100644 vsSolutionBuildEvent/Exceptions/NotFoundException.cs rename vsSolutionBuildEvent/Exceptions/{SBEException.cs => UnspecSBEException.cs} (58%) delete mode 100644 vsSolutionBuildEvent/ILogData.cs create mode 100644 vsSolutionBuildEvent/MSBuild.cs delete mode 100644 vsSolutionBuildEvent/MSBuild/Exceptions/MSBProjectNotFoundException.cs delete mode 100644 vsSolutionBuildEvent/MSBuild/Exceptions/MSBPropertyNotFoundException.cs delete mode 100644 vsSolutionBuildEvent/MSBuild/Exceptions/MSBPropertyParseException.cs delete mode 100644 vsSolutionBuildEvent/MSBuild/Exceptions/PossibleLoopException.cs delete mode 100644 vsSolutionBuildEvent/MSBuild/IMSBuild.cs delete mode 100644 vsSolutionBuildEvent/MSBuild/Parser.cs delete mode 100644 vsSolutionBuildEvent/MSBuild/PreparedData.cs delete mode 100644 vsSolutionBuildEvent/MSBuild/PropertyItem.cs delete mode 100644 vsSolutionBuildEvent/MSBuild/RPattern.cs delete mode 100644 vsSolutionBuildEvent/MSBuild/StringHandler.cs create mode 100644 vsSolutionBuildEvent/OwpEnv.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Bootloader.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/CValueType.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/BoxComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/Build/ProjectsMap.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/BuildComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/CommentComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/Component.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/Condition/Expression.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/ConditionComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/DTEComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/FileComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/FunctionComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/IComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/MSBuildComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/NuGet/GetNuTool/Core.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/NuGet/GetNuTool/GNT.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/NuGetComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/OWPComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/SevenZipComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/TryComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Components/UserVariableComponent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/CompletionData.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/ComponentAttribute.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/DefinitionAttribute.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/DomParser.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/IAttrDomLevelA.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/IAttrDomLevelB.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/IInspector.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/INodeInfo.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/InfoType.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/Inspector.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/MethodAttribute.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/NodeIdent.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/NodeInfo.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Dom/PropertyAttribute.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Exceptions/ArgumentPMException.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Exceptions/IncorrectNodeException.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Exceptions/NotSupportedOperationException.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Exceptions/OperandNotFoundException.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Exceptions/OperationNotFoundException.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Exceptions/ScriptException.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Exceptions/SelectorMismatchException.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Exceptions/SubtypeNotFoundException.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Exceptions/SyntaxIncorrectException.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/IBootloader.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/ISBEScript.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/RPattern.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/SNode/Argument.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/SNode/ArgumentType.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/SNode/EvalType.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/SNode/ILevel.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/SNode/IPM.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/SNode/Level.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/SNode/LevelType.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/SNode/PM.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Script.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/StringHandler.cs delete mode 100644 vsSolutionBuildEvent/SBEScripts/Value.cs delete mode 100644 vsSolutionBuildEvent/Scripts/EvaluatorBlank.cs delete mode 100644 vsSolutionBuildEvent/Scripts/IEvaluator.cs delete mode 100644 vsSolutionBuildEvent/Scripts/IUserVariable.cs delete mode 100644 vsSolutionBuildEvent/Scripts/IUserVariableDebug.cs delete mode 100644 vsSolutionBuildEvent/Scripts/StringProtector.cs delete mode 100644 vsSolutionBuildEvent/Scripts/TUserVariable.cs delete mode 100644 vsSolutionBuildEvent/Scripts/Tokens.cs delete mode 100644 vsSolutionBuildEvent/Scripts/UserVariable.cs rename vsSolutionBuildEvent/{SBEScripts => SobaScript}/Components/InternalComponent.cs (62%) create mode 100644 vsSolutionBuildEvent/SzArchiver.cs create mode 100644 vsSolutionBuildEvent/UI/WForms/Controls/CompletionData.cs rename vsSolutionBuildEvent/{SBEScripts/Dom/Icon.Designer.cs => UI/WForms/Controls/DomIcon.Designer.cs} (94%) rename vsSolutionBuildEvent/{SBEScripts/Dom/Icon.resx => UI/WForms/Controls/DomIcon.resx} (91%) delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/BoxComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/BuildComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/CommentComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/ConditionComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/DTEComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/FileComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/FunctionComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/InternalComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/MSBuildComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/NuGetComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/OWPComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/SevenZipComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/TryComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/Components/UserVariableComponentTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/RPatternTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/SNode/LevelTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/SNode/PMTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/ScriptTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/StringHandlerTest.cs delete mode 100644 vsSolutionBuildEventTest/SBEScripts/ValueTest.cs delete mode 100644 vsSolutionBuildEventTest/Scripts/UserVariableTest.cs create mode 100644 vsSolutionBuildEventTest/SobaAcs.cs create mode 100644 vsSolutionBuildEventTest/SobaScript/Components/InternalComponentTest.cs create mode 100644 vsSolutionBuildEventTest/key.snk diff --git a/.gitmodules b/.gitmodules index c3beed8d..1a82024d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,18 @@ [submodule "MvsSln"] path = MvsSln url = https://github.com/3F/MvsSln.git +[submodule "E-MSBuild"] + path = E-MSBuild + url = https://github.com/3F/E-MSBuild.git +[submodule "SobaScript"] + path = SobaScript + url = https://github.com/3F/SobaScript.git +[submodule "SobaScript.Z.Core"] + path = SobaScript.Z.Core + url = https://github.com/3F/SobaScript.Z.Core.git +[submodule "SobaScript.Z.Ext"] + path = SobaScript.Z.Ext + url = https://github.com/3F/SobaScript.Z.Ext.git +[submodule "SobaScript.Z.VS"] + path = SobaScript.Z.VS + url = https://github.com/3F/SobaScript.Z.VS.git diff --git a/.gnt/packages.config b/.gnt/packages.config index db1c8b18..8410c5a8 100644 --- a/.gnt/packages.config +++ b/.gnt/packages.config @@ -1,5 +1,5 @@  + - \ No newline at end of file diff --git a/.vssbe b/.vssbe index f89d955e..56805c88 100644 --- a/.vssbe +++ b/.vssbe @@ -91,7 +91,7 @@ "Mode": { "$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent", "Type": "Script", - "Command": "$(revDeltaBase = \"2016/11/05\")\n$(revDeltaMin = $([System.Math]::Pow(10, 3)))\n$$(revDeltaMax = $([System.Math]::Pow(10, 5)))\n$(revDeltaMax = 65534) #[\" limit of AssemblyVersion (2^16 - 2) - i.e. 65534 max allowed \"]\n\n#[\" \n To restore packages via GetNuTool\n https://github.com/NuGet/Home/issues/1521\n\"]\n#[NuGet gnt.raw(\"/p:ngconfig=\\\".gnt/packages.config\\\"\")]", + "Command": "$(revDeltaBase = \"2016/11/05\")\n$(revDeltaMin = $([System.Math]::Pow(10, 3)))\n$$(revDeltaMax = $([System.Math]::Pow(10, 5)))\n$(revDeltaMax = 65534) #[\" limit of AssemblyVersion (2^16 - 2) - i.e. 65534 max allowed \"]\n\n#[\" \n To restore packages via GetNuTool\n https://github.com/NuGet/Home/issues/1521\n\"]\n##[NuGet gnt.raw(\"/p:ngconfig=\\\".gnt/packages.config\\\"\")]", "Command__": [ "$(revDeltaBase = \"2016/11/05\")", "$(revDeltaMin = $([System.Math]::Pow(10, 3)))", @@ -102,7 +102,7 @@ " To restore packages via GetNuTool", " https://github.com/NuGet/Home/issues/1521", "\"]", - "#[NuGet gnt.raw(\"/p:ngconfig=\\\".gnt/packages.config\\\"\")]" + "##[NuGet gnt.raw(\"/p:ngconfig=\\\".gnt/packages.config\\\"\")]" ] } }, @@ -192,16 +192,38 @@ "Mode": { "$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent", "Type": "Script", - "Command": "\r\n#[File call(\"submodules.bat\", \"$(pMvsSln)/MvsSln.sln\", 2000)]\r\n\r\n#[\" Packages \"]\r\n\r\n#[( !(#[IO exists.directory(\"packages\")]) || !(#[IO exists.directory(\"$(pMvsSln)/packages\")]) )\r\n{\r\n #[File call(\"packages.cmd\", \"\", 2000)]\r\n}]", + "Command": "#[( !(#[IO exists.file(\"$(pMvsSln)/MvsSln.sln\")]) )\n{\n #[File call(\"git\", \"submodule update --init --recursive MvsSln\", 1000)]\n}]\n\n#[( !(#[IO exists.file(\"SobaScript/SobaScript.sln\")]) )\n{\n #[File call(\"git\", \"submodule update --init --recursive SobaScript\", 1000)]\n #[File call(\"git\", \"submodule update --init --recursive E-MSBuild\", 1000)]\n}]\n\n#[( !(#[IO exists.file(\"SobaScript.Z.Core/SobaScript.Z.Core.sln\")]) )\n{\n #[File call(\"git\", \"submodule update --init --recursive SobaScript.Z.Core\", 1000)]\n #[File call(\"git\", \"submodule update --init --recursive SobaScript.Z.Ext\", 1000)]\n #[File call(\"git\", \"submodule update --init --recursive SobaScript.Z.VS\", 1000)]\n}]\n\n\n\n#[\" Packages \"]\n\n#[( !(#[IO exists.file(\"packages/__checked\")]) || !(#[IO exists.directory(\"$(pMvsSln)/packages\")]) )\n{\n #[File call(\"tools\\hmsbuild.bat\", \"-t:restore /v:q /nologo /p:Configuration=$(Configuration) /p:Platform=\\\"Any CPU\\\"\", 1000)]\n \n #[File call(\"packages.cmd\", \"\", 1000)]\n \n #[IO copy.directory(\"\", \"packages/\", true)]\n #[File write(\"packages/__checked\"): ]\n}]", "Command__": [ + "#[( !(#[IO exists.file(\"$(pMvsSln)/MvsSln.sln\")]) )", + "{", + " #[File call(\"git\", \"submodule update --init --recursive MvsSln\", 1000)]", + "}]", + "", + "#[( !(#[IO exists.file(\"SobaScript/SobaScript.sln\")]) )", + "{", + " #[File call(\"git\", \"submodule update --init --recursive SobaScript\", 1000)]", + " #[File call(\"git\", \"submodule update --init --recursive E-MSBuild\", 1000)]", + "}]", + "", + "#[( !(#[IO exists.file(\"SobaScript.Z.Core/SobaScript.Z.Core.sln\")]) )", + "{", + " #[File call(\"git\", \"submodule update --init --recursive SobaScript.Z.Core\", 1000)]", + " #[File call(\"git\", \"submodule update --init --recursive SobaScript.Z.Ext\", 1000)]", + " #[File call(\"git\", \"submodule update --init --recursive SobaScript.Z.VS\", 1000)]", + "}]", + "", "", - "#[File call(\"submodules.bat\", \"$(pMvsSln)/MvsSln.sln\", 2000)]", "", "#[\" Packages \"]", "", - "#[( !(#[IO exists.directory(\"packages\")]) || !(#[IO exists.directory(\"$(pMvsSln)/packages\")]) )", + "#[( !(#[IO exists.file(\"packages/__checked\")]) || !(#[IO exists.directory(\"$(pMvsSln)/packages\")]) )", "{", - " #[File call(\"packages.cmd\", \"\", 2000)]", + " #[File call(\"tools\\hmsbuild.bat\", \"-t:restore /v:q /nologo /p:Configuration=$(Configuration) /p:Platform=\\\"Any CPU\\\"\", 1000)]", + " ", + " #[File call(\"packages.cmd\", \"\", 1000)]", + " ", + " #[IO copy.directory(\"\", \"packages/\", true)]", + " #[File write(\"packages/__checked\"): ]", "}]" ] } diff --git a/CI.MSBuild/EventManager.cs b/CI.MSBuild/EventManager.cs index cf583fc8..34e02fa5 100644 --- a/CI.MSBuild/EventManager.cs +++ b/CI.MSBuild/EventManager.cs @@ -104,6 +104,10 @@ public override void Initialize(IEventSource evt) log = new Log(Verbosity); initializer = new Initializer(Parameters, log); + if(!log.IsDiagnostic) { + log.info($"set {Log.DIAG_KEY}= true to enable diagnostic mode."); + } + // load with properties by default library = initializer.load(); setPropertiesByDefault(); diff --git a/CI.MSBuild/Initializer.cs b/CI.MSBuild/Initializer.cs index 187526d3..62abd860 100644 --- a/CI.MSBuild/Initializer.cs +++ b/CI.MSBuild/Initializer.cs @@ -207,7 +207,7 @@ protected void header() log.info(new String('=', 37)); log.info("Version: v{0}", System.Diagnostics.FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion); log.info($"Copyright (c) 2013-{Math.Max(2019, DateTime.Now.Year)} Denis Kuzmin < entry.reg@gmail.com > GitHub/3F"); - log.info(new String('_', 70)); + log.info(new String('_', 70) + Environment.NewLine); } /// diff --git a/CI.MSBuild/Log.cs b/CI.MSBuild/Log.cs index 51ba1e6f..3ce7fa7e 100644 --- a/CI.MSBuild/Log.cs +++ b/CI.MSBuild/Log.cs @@ -30,12 +30,21 @@ namespace net.r_eg.vsSBE.CI.MSBuild //TODO: Either use from MvsSln or NLog from main plugin internal class Log: ILog { + internal const string DIAG_KEY = "__vssbe_diag"; + /// /// Flag of Diagnostic mode /// public bool IsDiagnostic { - get => level == LoggerVerbosity.Diagnostic; + //level == LoggerVerbosity.Diagnostic; + get => string.Equals + ( + //TODO: + Environment.GetEnvironmentVariable(DIAG_KEY, EnvironmentVariableTarget.Process)?.Trim(), + "true", + StringComparison.InvariantCultureIgnoreCase + ); } /// diff --git a/E-MSBuild b/E-MSBuild new file mode 160000 index 00000000..a855a442 --- /dev/null +++ b/E-MSBuild @@ -0,0 +1 @@ +Subproject commit a855a44205bfebe5a74df4b5d5506d90c3decd12 diff --git a/SobaScript b/SobaScript new file mode 160000 index 00000000..2c7941a2 --- /dev/null +++ b/SobaScript @@ -0,0 +1 @@ +Subproject commit 2c7941a2cb7c4c5e0f6d5b02c6d24613a3a59fbe diff --git a/SobaScript.Z.Core b/SobaScript.Z.Core new file mode 160000 index 00000000..226e08a8 --- /dev/null +++ b/SobaScript.Z.Core @@ -0,0 +1 @@ +Subproject commit 226e08a88fd2a745846bfc7478fea3e19eee65b4 diff --git a/SobaScript.Z.Ext b/SobaScript.Z.Ext new file mode 160000 index 00000000..b4b40b8a --- /dev/null +++ b/SobaScript.Z.Ext @@ -0,0 +1 @@ +Subproject commit b4b40b8a76132242970085489e5fd4777aaa4939 diff --git a/SobaScript.Z.VS b/SobaScript.Z.VS new file mode 160000 index 00000000..481acc9a --- /dev/null +++ b/SobaScript.Z.VS @@ -0,0 +1 @@ +Subproject commit 481acc9a307ba9881f67e9f2d7ea2cc6cbb0c9f7 diff --git a/VsixLib.targets b/VsixLib.targets index f685aa4e..69260805 100644 --- a/VsixLib.targets +++ b/VsixLib.targets @@ -8,6 +8,7 @@ false %(Filename)%(Extension) true + x64\ --> @@ -22,8 +23,13 @@ - - + + + + + + + diff --git a/build.bat b/build.bat index e4fe1bda..cad0d2d4 100644 --- a/build.bat +++ b/build.bat @@ -32,15 +32,16 @@ if "%reltype%"=="" ( set __p_call=1 -:: Packages +:: package restore for SDK-based projects +:: call %_msbuild% -t:restore /p:Configuration=%reltype%_SDK15 /p:Platform="Any CPU" -call .\packages.cmd || goto err +:: Activate vsSBE -:: call %_msbuild% ".gnt/gnt.core" /p:ngpath="%cd%/packages" /p:ngconfig="%cd%/.gnt/packages.config;%cd%/vsSolutionBuildEvent/packages.config;%cd%/vsSolutionBuildEventTest/packages.config" /nologo /v:m +call %_gnt% /p:ngpath="%cd%/packages" /p:ngconfig="%cd%/.gnt/packages.config" || goto err :: Build -set bnode=%_msbuild% %sln% /m:4 /l:"%cimdll%" /p:Platform=%platform% /v:%level% +set bnode=%_msbuild% %sln% /m:4 /l:"%cimdll%" /p:Platform=%platform% /v:%level% /nologo call %bnode% /p:Configuration=%reltype%_SDK10 /t:Rebuild || goto err call %bnode% /p:Configuration=%reltype%_SDK15 /t:Build || goto err diff --git a/packages.cmd b/packages.cmd index ed62c760..2ceed796 100644 --- a/packages.cmd +++ b/packages.cmd @@ -5,6 +5,7 @@ set _gnt=tools/gnt set _gntArgs=%* +set _pkgdir=packages :found @@ -22,7 +23,7 @@ call %_gnt% %_gntArgs% /p:wpath="%cd%/MvsSln" /p:ngconfig="packages.config;MvsSl :: - echo. echo vsSolutionBuildEvent ... -call %_gnt% %_gntArgs% /p:ngpath="%cd%/packages" /p:ngconfig="%cd%/.gnt/packages.config;%cd%/vsSolutionBuildEvent/packages.config;%cd%/vsSolutionBuildEventTest/packages.config" /nologo /v:m || goto err +call %_gnt% %_gntArgs% /p:wpath="%cd%" /p:ngpath="%_pkgdir%" /p:ngconfig=".gnt/packages.config;vsSolutionBuildEvent/packages.config;vsSolutionBuildEventTest/packages.config" /nologo /v:m || goto err goto exit diff --git a/submodules.bat b/submodules.bat deleted file mode 100644 index 09c9c80e..00000000 --- a/submodules.bat +++ /dev/null @@ -1,47 +0,0 @@ -@echo off - -echo Checking submodules ... - -set _dep=%1 - -if "%_dep%"=="" ( - echo Incorrect command. Please use `build.bat` instead of this. - exit /B 0 -) - - -if not exist "%_dep%" goto restore -exit /B 0 - -:restore - -echo. -echo. Whoops, you need to update git submodules. -echo. But we'll update this automatically. -echo. -echo. Please wait... -echo. - - -:: MvsSln -git submodule update --init --recursive MvsSln || goto gitNotFound - - -exit /B 0 - -:gitNotFound - -if not exist ".git" ( - echo. 1>&2 - echo To restore submodules via Git scm you should have a `.git` folder, but we can't find this. 1>&2 - echo Unfortunately you should get this manually, or try to clone initially with recursive option: `git clone --recursive ...` 1>&2 - exit /B 3 -) - -echo. 1>&2 -echo. `git` was not found or something went wrong. Check your connection and env. variable `PATH`. Or get submodules manually: 1>&2 -echo. 1. Use command `git submodule update --init --recursive` 1>&2 -echo. 2. Or clone initially with recursive option: `git clone --recursive ...` 1>&2 -echo. 1>&2 - -exit /B 2 \ No newline at end of file diff --git a/vsSolutionBuildEvent.sln b/vsSolutionBuildEvent.sln index b7e95745..94d960c2 100644 --- a/vsSolutionBuildEvent.sln +++ b/vsSolutionBuildEvent.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.13 +VisualStudioVersion = 15.0.28307.852 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CIMLib", "CIMLib\CIMLib.csproj", "{A7BF1F9C-F18D-423E-9354-859DC3CFAFD4}" EndProject @@ -65,6 +65,167 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvsSlnTest", "MvsSln\MvsSln {F905DFB2-2E67-4FF7-9001-924F6F2D645D} = {F905DFB2-2E67-4FF7-9001-924F6F2D645D} EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "E-MSBuild", "E-MSBuild", "{C9F82ABC-8BEE-4986-AE5F-434BC6B43108}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "E-MSBuild", "E-MSBuild\E-MSBuild\E-MSBuild.csproj", "{E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "E-MSBuildTest", "E-MSBuild\E-MSBuildTest\E-MSBuildTest.csproj", "{CF0425EE-79D7-40BB-A2C4-9640110E4D1A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{C6BC75D7-6F3A-4483-A701-D94BDDA9D6DB}" + ProjectSection(SolutionItems) = preProject + E-MSBuild\License.txt = E-MSBuild\License.txt + E-MSBuild\Readme.md = E-MSBuild\Readme.md + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Varhead", "E-MSBuild\Varhead\Varhead\Varhead.csproj", "{4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VarheadTest", "E-MSBuild\Varhead\VarheadTest\VarheadTest.csproj", "{BDDB36ED-D15F-444F-86DA-C0CBC4E18237}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LSender", "E-MSBuild\Varhead\LSender\LSender\LSender.csproj", "{287D8F67-DD08-423F-AA60-C48D84140612}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LSenderTest", "E-MSBuild\Varhead\LSender\LSenderTest\LSenderTest.csproj", "{28C85A73-60C8-457D-8893-E683A0DC7E09}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SobaScript", "SobaScript", "{E89BCCAC-9C83-4921-99A5-6608CDB27588}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript", "SobaScript\SobaScript\SobaScript.csproj", "{3A80B650-B457-4DE4-B2D3-64191A20C6B7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScriptTest", "SobaScript\SobaScriptTest\SobaScriptTest.csproj", "{1C15650D-0969-4857-84EB-21F9515B63D9}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{7933B475-B565-4C72-B27B-5533AA988678}" + ProjectSection(SolutionItems) = preProject + SobaScript\3rd-party = SobaScript\3rd-party + SobaScript\License.txt = SobaScript\License.txt + SobaScript\Readme.md = SobaScript\Readme.md + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "E-MSBuild", "SobaScript\E-MSBuild\E-MSBuild\E-MSBuild.csproj", "{4F41C792-E070-42B5-9BE5-8B496D21F123}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Varhead", "SobaScript\E-MSBuild\Varhead\Varhead\Varhead.csproj", "{D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LSender", "SobaScript\E-MSBuild\Varhead\LSender\LSender\LSender.csproj", "{09974DE1-98BF-4D9B-81EF-8F41E86861B8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SobaScript.Z.Core", "SobaScript.Z.Core", "{F80D640F-B95D-4EC3-96BF-03231726E370}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript.Z.Core", "SobaScript.Z.Core\SobaScript.Z.Core\SobaScript.Z.Core.csproj", "{D5C9A407-1173-43BF-A15A-5D8AB100AC4A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript.Z.CoreTest", "SobaScript.Z.Core\SobaScript.Z.CoreTest\SobaScript.Z.CoreTest.csproj", "{3614D53F-DDF3-4A47-A093-510858D2E041}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript", "SobaScript.Z.Core\SobaScript\SobaScript\SobaScript.csproj", "{071417C6-76FA-4202-8F39-296BE4D722C3}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{9BFFAA1D-F604-4487-9FF2-06A73995913C}" + ProjectSection(SolutionItems) = preProject + SobaScript.Z.Core\SobaScript\3rd-party = SobaScript.Z.Core\SobaScript\3rd-party + SobaScript.Z.Core\SobaScript\License.txt = SobaScript.Z.Core\SobaScript\License.txt + SobaScript.Z.Core\SobaScript\Readme.md = SobaScript.Z.Core\SobaScript\Readme.md + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "E-MSBuild", "SobaScript.Z.Core\SobaScript\E-MSBuild\E-MSBuild\E-MSBuild.csproj", "{AE165012-0E23-41C6-B9AC-D8EC4DD4D873}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Varhead", "SobaScript.Z.Core\SobaScript\E-MSBuild\Varhead\Varhead\Varhead.csproj", "{9250C639-5C15-4085-B2B6-B43B33A6FD7D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LSender", "SobaScript.Z.Core\SobaScript\E-MSBuild\Varhead\LSender\LSender\LSender.csproj", "{B25B76B1-054D-4F41-906A-9A05F05A6C4A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dep", "dep", "{88368C47-6D83-42C2-BF3E-79583EACF29C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript.Mapper", "SobaScript.Z.Core\SobaScript.Mapper\SobaScript.Mapper\SobaScript.Mapper.csproj", "{3EABD66D-1F4B-46E5-88FF-3E680708309F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript.MapperTest", "SobaScript.Z.Core\SobaScript.Mapper\SobaScript.MapperTest\SobaScript.MapperTest.csproj", "{FBCBF2C5-4F45-421C-86A1-4300E94F91CA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript", "SobaScript.Z.Core\SobaScript.Mapper\SobaScript\SobaScript\SobaScript.csproj", "{5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{54A3EE80-7894-433B-80BA-E29B0331B5B3}" + ProjectSection(SolutionItems) = preProject + SobaScript.Z.Core\SobaScript.Mapper\SobaScript\3rd-party = SobaScript.Z.Core\SobaScript.Mapper\SobaScript\3rd-party + SobaScript.Z.Core\SobaScript.Mapper\SobaScript\License.txt = SobaScript.Z.Core\SobaScript.Mapper\SobaScript\License.txt + SobaScript.Z.Core\SobaScript.Mapper\SobaScript\Readme.md = SobaScript.Z.Core\SobaScript.Mapper\SobaScript\Readme.md + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "E-MSBuild", "SobaScript.Z.Core\SobaScript.Mapper\SobaScript\E-MSBuild\E-MSBuild\E-MSBuild.csproj", "{0BB9F0C4-CC70-41A5-8D04-56952B686C8F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Varhead", "SobaScript.Z.Core\SobaScript.Mapper\SobaScript\E-MSBuild\Varhead\Varhead\Varhead.csproj", "{D2185E13-8D1F-4C9E-B655-FE735F0542ED}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LSender", "SobaScript.Z.Core\SobaScript.Mapper\SobaScript\E-MSBuild\Varhead\LSender\LSender\LSender.csproj", "{F76493C4-06AC-4B7F-A9B7-743D10336A7B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SobaScript.Z.Ext", "SobaScript.Z.Ext", "{794BC045-8F76-45C2-9DF4-F8D172B4645D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript.Z.Ext", "SobaScript.Z.Ext\SobaScript.Z.Ext\SobaScript.Z.Ext.csproj", "{0FB9BD48-D455-40DC-A6BF-411B595A2999}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript.Z.ExtTest", "SobaScript.Z.Ext\SobaScript.Z.ExtTest\SobaScript.Z.ExtTest.csproj", "{ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript", "SobaScript.Z.Ext\SobaScript\SobaScript\SobaScript.csproj", "{87C30203-7734-44AB-97E1-655423A4226C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{1331726D-E1FC-430D-8D92-8D5609DF9C89}" + ProjectSection(SolutionItems) = preProject + SobaScript.Z.Ext\SobaScript\3rd-party = SobaScript.Z.Ext\SobaScript\3rd-party + SobaScript.Z.Ext\SobaScript\License.txt = SobaScript.Z.Ext\SobaScript\License.txt + SobaScript.Z.Ext\SobaScript\Readme.md = SobaScript.Z.Ext\SobaScript\Readme.md + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "E-MSBuild", "SobaScript.Z.Ext\SobaScript\E-MSBuild\E-MSBuild\E-MSBuild.csproj", "{865B428A-0849-4C6B-9C80-365686DF32F6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Varhead", "SobaScript.Z.Ext\SobaScript\E-MSBuild\Varhead\Varhead\Varhead.csproj", "{7F536E70-7C86-4652-A375-514208BEC106}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LSender", "SobaScript.Z.Ext\SobaScript\E-MSBuild\Varhead\LSender\LSender\LSender.csproj", "{E3448205-A5BC-4A72-A770-27CAACC2B94F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dep", "dep", "{F1C9D9FE-B14C-43F1-A147-52AA472496AE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript.Mapper", "SobaScript.Z.Ext\SobaScript.Mapper\SobaScript.Mapper\SobaScript.Mapper.csproj", "{54162407-B17A-422B-8169-AEBA55ECB18E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript", "SobaScript.Z.Ext\SobaScript.Mapper\SobaScript\SobaScript\SobaScript.csproj", "{07FBE938-36C1-45CB-86CB-04286424CCE0}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{A57876ED-5050-47E8-90C9-064256D6AF87}" + ProjectSection(SolutionItems) = preProject + SobaScript.Z.Ext\SobaScript.Mapper\SobaScript\3rd-party = SobaScript.Z.Ext\SobaScript.Mapper\SobaScript\3rd-party + SobaScript.Z.Ext\SobaScript.Mapper\SobaScript\License.txt = SobaScript.Z.Ext\SobaScript.Mapper\SobaScript\License.txt + SobaScript.Z.Ext\SobaScript.Mapper\SobaScript\Readme.md = SobaScript.Z.Ext\SobaScript.Mapper\SobaScript\Readme.md + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "E-MSBuild", "SobaScript.Z.Ext\SobaScript.Mapper\SobaScript\E-MSBuild\E-MSBuild\E-MSBuild.csproj", "{6ED93EA0-32CF-4E06-B6A4-87651E440800}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Varhead", "SobaScript.Z.Ext\SobaScript.Mapper\SobaScript\E-MSBuild\Varhead\Varhead\Varhead.csproj", "{E900207F-E045-4B1E-92F8-645938FB2EBF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LSender", "SobaScript.Z.Ext\SobaScript.Mapper\SobaScript\E-MSBuild\Varhead\LSender\LSender\LSender.csproj", "{C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SobaScript.Z.VS", "SobaScript.Z.VS", "{E003B199-974D-4668-9A19-20EB76952795}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript.Z.VS", "SobaScript.Z.VS\SobaScript.Z.VS\SobaScript.Z.VS.csproj", "{CD42837F-ECB4-48D5-89D5-EFF831001F89}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript.Z.VSTest", "SobaScript.Z.VS\SobaScript.Z.VSTest\SobaScript.Z.VSTest.csproj", "{52BC79FD-E02A-461D-BC20-26A3713EF6D5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript", "SobaScript.Z.VS\SobaScript\SobaScript\SobaScript.csproj", "{E50D4351-35BE-45F3-BD0A-91A91A85F493}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{54482EC9-3430-4976-BAB6-278F381542FF}" + ProjectSection(SolutionItems) = preProject + SobaScript.Z.VS\SobaScript\3rd-party = SobaScript.Z.VS\SobaScript\3rd-party + SobaScript.Z.VS\SobaScript\License.txt = SobaScript.Z.VS\SobaScript\License.txt + SobaScript.Z.VS\SobaScript\Readme.md = SobaScript.Z.VS\SobaScript\Readme.md + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "E-MSBuild", "SobaScript.Z.VS\SobaScript\E-MSBuild\E-MSBuild\E-MSBuild.csproj", "{A0165A47-76BD-4003-AC99-D5174B23A1C7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Varhead", "SobaScript.Z.VS\SobaScript\E-MSBuild\Varhead\Varhead\Varhead.csproj", "{AB053705-659D-4872-8455-464BF6399B6C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LSender", "SobaScript.Z.VS\SobaScript\E-MSBuild\Varhead\LSender\LSender\LSender.csproj", "{3BFA5555-DDB2-4688-A8F0-611D083BF19B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dep", "dep", "{8B4B7D7C-313A-45CE-8004-70047FDD554B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript.Mapper", "SobaScript.Z.VS\SobaScript.Mapper\SobaScript.Mapper\SobaScript.Mapper.csproj", "{1AA280BC-C271-499F-A200-57373693430B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SobaScript", "SobaScript.Z.VS\SobaScript.Mapper\SobaScript\SobaScript\SobaScript.csproj", "{8CFFF022-160C-41C0-A9E2-1646338A91D9}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{870A24A8-1392-4444-82AE-AD1CB7B20693}" + ProjectSection(SolutionItems) = preProject + SobaScript.Z.VS\SobaScript.Mapper\SobaScript\3rd-party = SobaScript.Z.VS\SobaScript.Mapper\SobaScript\3rd-party + SobaScript.Z.VS\SobaScript.Mapper\SobaScript\License.txt = SobaScript.Z.VS\SobaScript.Mapper\SobaScript\License.txt + SobaScript.Z.VS\SobaScript.Mapper\SobaScript\Readme.md = SobaScript.Z.VS\SobaScript.Mapper\SobaScript\Readme.md + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "E-MSBuild", "SobaScript.Z.VS\SobaScript.Mapper\SobaScript\E-MSBuild\E-MSBuild\E-MSBuild.csproj", "{C4597678-FD09-4D21-9222-4E0BB85F8A96}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Varhead", "SobaScript.Z.VS\SobaScript.Mapper\SobaScript\E-MSBuild\Varhead\Varhead\Varhead.csproj", "{CD998E51-E4B4-44E4-950C-547737C5AF48}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LSender", "SobaScript.Z.VS\SobaScript.Mapper\SobaScript\E-MSBuild\Varhead\LSender\LSender\LSender.csproj", "{5CE43FBF-EE44-4DCC-A660-115244E20ABF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution DBG_SDK10|Any CPU = DBG_SDK10|Any CPU @@ -233,11 +394,789 @@ Global {EC0CA220-39EC-41E5-B9D6-88D8F860F979}.REL_SDK10|Any CPU.Build.0 = Release|Any CPU {EC0CA220-39EC-41E5-B9D6-88D8F860F979}.REL_SDK15|Any CPU.ActiveCfg = Release|Any CPU {EC0CA220-39EC-41E5-B9D6-88D8F860F979}.REL_SDK15|Any CPU.Build.0 = Release|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {287D8F67-DD08-423F-AA60-C48D84140612}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {28C85A73-60C8-457D-8893-E683A0DC7E09}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {3A80B650-B457-4DE4-B2D3-64191A20C6B7}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {1C15650D-0969-4857-84EB-21F9515B63D9}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {4F41C792-E070-42B5-9BE5-8B496D21F123}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {09974DE1-98BF-4D9B-81EF-8F41E86861B8}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {3614D53F-DDF3-4A47-A093-510858D2E041}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {071417C6-76FA-4202-8F39-296BE4D722C3}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {9250C639-5C15-4085-B2B6-B43B33A6FD7D}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {B25B76B1-054D-4F41-906A-9A05F05A6C4A}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {3EABD66D-1F4B-46E5-88FF-3E680708309F}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {D2185E13-8D1F-4C9E-B655-FE735F0542ED}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {F76493C4-06AC-4B7F-A9B7-743D10336A7B}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {0FB9BD48-D455-40DC-A6BF-411B595A2999}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {87C30203-7734-44AB-97E1-655423A4226C}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {865B428A-0849-4C6B-9C80-365686DF32F6}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {7F536E70-7C86-4652-A375-514208BEC106}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {E3448205-A5BC-4A72-A770-27CAACC2B94F}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {54162407-B17A-422B-8169-AEBA55ECB18E}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {07FBE938-36C1-45CB-86CB-04286424CCE0}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {6ED93EA0-32CF-4E06-B6A4-87651E440800}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {E900207F-E045-4B1E-92F8-645938FB2EBF}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {CD42837F-ECB4-48D5-89D5-EFF831001F89}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {52BC79FD-E02A-461D-BC20-26A3713EF6D5}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {E50D4351-35BE-45F3-BD0A-91A91A85F493}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {A0165A47-76BD-4003-AC99-D5174B23A1C7}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {AB053705-659D-4872-8455-464BF6399B6C}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {3BFA5555-DDB2-4688-A8F0-611D083BF19B}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {1AA280BC-C271-499F-A200-57373693430B}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {8CFFF022-160C-41C0-A9E2-1646338A91D9}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {C4597678-FD09-4D21-9222-4E0BB85F8A96}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {CD998E51-E4B4-44E4-950C-547737C5AF48}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.DBG_SDK10|Any CPU.ActiveCfg = DBG_SDK10|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.DBG_SDK10|Any CPU.Build.0 = DBG_SDK10|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.DBG_SDK15|Any CPU.ActiveCfg = DBG_SDK15|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.DBG_SDK15|Any CPU.Build.0 = DBG_SDK15|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.DCI_SDK10|Any CPU.ActiveCfg = DCI_SDK10|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.DCI_SDK10|Any CPU.Build.0 = DCI_SDK10|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.DCI_SDK15|Any CPU.ActiveCfg = DCI_SDK15|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.DCI_SDK15|Any CPU.Build.0 = DCI_SDK15|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.RCI_SDK10|Any CPU.ActiveCfg = RCI_SDK10|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.RCI_SDK10|Any CPU.Build.0 = RCI_SDK10|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.RCI_SDK15|Any CPU.ActiveCfg = RCI_SDK15|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.RCI_SDK15|Any CPU.Build.0 = RCI_SDK15|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.REL_SDK10|Any CPU.ActiveCfg = REL_SDK10|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.REL_SDK10|Any CPU.Build.0 = REL_SDK10|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.REL_SDK15|Any CPU.ActiveCfg = REL_SDK15|Any CPU + {5CE43FBF-EE44-4DCC-A660-115244E20ABF}.REL_SDK15|Any CPU.Build.0 = REL_SDK15|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {E51D1EA3-F4A7-4F27-A941-E16D2B88D08A} = {C9F82ABC-8BEE-4986-AE5F-434BC6B43108} + {CF0425EE-79D7-40BB-A2C4-9640110E4D1A} = {C9F82ABC-8BEE-4986-AE5F-434BC6B43108} + {C6BC75D7-6F3A-4483-A701-D94BDDA9D6DB} = {C9F82ABC-8BEE-4986-AE5F-434BC6B43108} + {4670B9B4-1BA9-4CB2-BBFC-EC4EBEB40A42} = {C9F82ABC-8BEE-4986-AE5F-434BC6B43108} + {BDDB36ED-D15F-444F-86DA-C0CBC4E18237} = {C9F82ABC-8BEE-4986-AE5F-434BC6B43108} + {287D8F67-DD08-423F-AA60-C48D84140612} = {C9F82ABC-8BEE-4986-AE5F-434BC6B43108} + {28C85A73-60C8-457D-8893-E683A0DC7E09} = {C9F82ABC-8BEE-4986-AE5F-434BC6B43108} + {3A80B650-B457-4DE4-B2D3-64191A20C6B7} = {E89BCCAC-9C83-4921-99A5-6608CDB27588} + {1C15650D-0969-4857-84EB-21F9515B63D9} = {E89BCCAC-9C83-4921-99A5-6608CDB27588} + {7933B475-B565-4C72-B27B-5533AA988678} = {E89BCCAC-9C83-4921-99A5-6608CDB27588} + {4F41C792-E070-42B5-9BE5-8B496D21F123} = {E89BCCAC-9C83-4921-99A5-6608CDB27588} + {D6F8B3AE-22FA-4C09-9EBA-A254DEFA968F} = {E89BCCAC-9C83-4921-99A5-6608CDB27588} + {09974DE1-98BF-4D9B-81EF-8F41E86861B8} = {E89BCCAC-9C83-4921-99A5-6608CDB27588} + {D5C9A407-1173-43BF-A15A-5D8AB100AC4A} = {F80D640F-B95D-4EC3-96BF-03231726E370} + {3614D53F-DDF3-4A47-A093-510858D2E041} = {F80D640F-B95D-4EC3-96BF-03231726E370} + {071417C6-76FA-4202-8F39-296BE4D722C3} = {F80D640F-B95D-4EC3-96BF-03231726E370} + {9BFFAA1D-F604-4487-9FF2-06A73995913C} = {F80D640F-B95D-4EC3-96BF-03231726E370} + {AE165012-0E23-41C6-B9AC-D8EC4DD4D873} = {F80D640F-B95D-4EC3-96BF-03231726E370} + {9250C639-5C15-4085-B2B6-B43B33A6FD7D} = {F80D640F-B95D-4EC3-96BF-03231726E370} + {B25B76B1-054D-4F41-906A-9A05F05A6C4A} = {F80D640F-B95D-4EC3-96BF-03231726E370} + {88368C47-6D83-42C2-BF3E-79583EACF29C} = {F80D640F-B95D-4EC3-96BF-03231726E370} + {3EABD66D-1F4B-46E5-88FF-3E680708309F} = {F80D640F-B95D-4EC3-96BF-03231726E370} + {FBCBF2C5-4F45-421C-86A1-4300E94F91CA} = {F80D640F-B95D-4EC3-96BF-03231726E370} + {5C96DF4F-267A-46DD-BA95-9F487E8DC1FE} = {88368C47-6D83-42C2-BF3E-79583EACF29C} + {54A3EE80-7894-433B-80BA-E29B0331B5B3} = {88368C47-6D83-42C2-BF3E-79583EACF29C} + {0BB9F0C4-CC70-41A5-8D04-56952B686C8F} = {88368C47-6D83-42C2-BF3E-79583EACF29C} + {D2185E13-8D1F-4C9E-B655-FE735F0542ED} = {88368C47-6D83-42C2-BF3E-79583EACF29C} + {F76493C4-06AC-4B7F-A9B7-743D10336A7B} = {88368C47-6D83-42C2-BF3E-79583EACF29C} + {0FB9BD48-D455-40DC-A6BF-411B595A2999} = {794BC045-8F76-45C2-9DF4-F8D172B4645D} + {ED50ABB4-C815-4A8E-9C35-C2973AE7E40C} = {794BC045-8F76-45C2-9DF4-F8D172B4645D} + {87C30203-7734-44AB-97E1-655423A4226C} = {794BC045-8F76-45C2-9DF4-F8D172B4645D} + {1331726D-E1FC-430D-8D92-8D5609DF9C89} = {794BC045-8F76-45C2-9DF4-F8D172B4645D} + {865B428A-0849-4C6B-9C80-365686DF32F6} = {794BC045-8F76-45C2-9DF4-F8D172B4645D} + {7F536E70-7C86-4652-A375-514208BEC106} = {794BC045-8F76-45C2-9DF4-F8D172B4645D} + {E3448205-A5BC-4A72-A770-27CAACC2B94F} = {794BC045-8F76-45C2-9DF4-F8D172B4645D} + {F1C9D9FE-B14C-43F1-A147-52AA472496AE} = {794BC045-8F76-45C2-9DF4-F8D172B4645D} + {54162407-B17A-422B-8169-AEBA55ECB18E} = {794BC045-8F76-45C2-9DF4-F8D172B4645D} + {07FBE938-36C1-45CB-86CB-04286424CCE0} = {F1C9D9FE-B14C-43F1-A147-52AA472496AE} + {A57876ED-5050-47E8-90C9-064256D6AF87} = {F1C9D9FE-B14C-43F1-A147-52AA472496AE} + {6ED93EA0-32CF-4E06-B6A4-87651E440800} = {F1C9D9FE-B14C-43F1-A147-52AA472496AE} + {E900207F-E045-4B1E-92F8-645938FB2EBF} = {F1C9D9FE-B14C-43F1-A147-52AA472496AE} + {C38C34FA-5F6C-43B1-A43A-F5F6ABD8D1E6} = {F1C9D9FE-B14C-43F1-A147-52AA472496AE} + {CD42837F-ECB4-48D5-89D5-EFF831001F89} = {E003B199-974D-4668-9A19-20EB76952795} + {52BC79FD-E02A-461D-BC20-26A3713EF6D5} = {E003B199-974D-4668-9A19-20EB76952795} + {E50D4351-35BE-45F3-BD0A-91A91A85F493} = {E003B199-974D-4668-9A19-20EB76952795} + {54482EC9-3430-4976-BAB6-278F381542FF} = {E003B199-974D-4668-9A19-20EB76952795} + {A0165A47-76BD-4003-AC99-D5174B23A1C7} = {E003B199-974D-4668-9A19-20EB76952795} + {AB053705-659D-4872-8455-464BF6399B6C} = {E003B199-974D-4668-9A19-20EB76952795} + {3BFA5555-DDB2-4688-A8F0-611D083BF19B} = {E003B199-974D-4668-9A19-20EB76952795} + {8B4B7D7C-313A-45CE-8004-70047FDD554B} = {E003B199-974D-4668-9A19-20EB76952795} + {1AA280BC-C271-499F-A200-57373693430B} = {E003B199-974D-4668-9A19-20EB76952795} + {8CFFF022-160C-41C0-A9E2-1646338A91D9} = {8B4B7D7C-313A-45CE-8004-70047FDD554B} + {870A24A8-1392-4444-82AE-AD1CB7B20693} = {8B4B7D7C-313A-45CE-8004-70047FDD554B} + {C4597678-FD09-4D21-9222-4E0BB85F8A96} = {8B4B7D7C-313A-45CE-8004-70047FDD554B} + {CD998E51-E4B4-44E4-950C-547737C5AF48} = {8B4B7D7C-313A-45CE-8004-70047FDD554B} + {5CE43FBF-EE44-4DCC-A660-115244E20ABF} = {8B4B7D7C-313A-45CE-8004-70047FDD554B} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {6B03C68E-11BB-4FD7-89D9-B15EF63899B5} + SolutionGuid = {6AB957CD-4591-40A5-B117-A7839E367EC2} EndGlobalSection EndGlobal diff --git a/vsSolutionBuildEvent/API/EventLevel.cs b/vsSolutionBuildEvent/API/EventLevel.cs index cc097b62..8edfc7bf 100644 --- a/vsSolutionBuildEvent/API/EventLevel.cs +++ b/vsSolutionBuildEvent/API/EventLevel.cs @@ -24,9 +24,9 @@ using net.r_eg.vsSBE.Bridge.CoreCommand; using net.r_eg.vsSBE.Clients; using net.r_eg.vsSBE.Configuration; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.Scripts; +using net.r_eg.EvMSBuild; +using net.r_eg.SobaScript.Components; +using System.Linq; #if VSSDK_15_AND_NEW using Microsoft.VisualStudio.Shell; @@ -56,11 +56,6 @@ public class EventLevel: IEventLevel, IEntryPointCore, IFireCoreCommand /// public event EventHandler ClosedSolution = delegate(object sender, EventArgs e) { }; - /// - /// Container of user-variables - /// - protected IUserVariable uvariable = new UserVariable(); - /// /// Provides command events for automation clients /// @@ -76,24 +71,17 @@ public class EventLevel: IEventLevel, IEntryPointCore, IFireCoreCommand /// protected IClientLibrary clientLib = new ClientLibrary(); + private Bootloader loader; + /// /// object synch. /// - private Object _lock = new Object(); - - /// - /// Main loader - /// - public IBootloader Bootloader - { - get; - protected set; - } + private readonly object sync = new object(); /// /// Binder of action /// - public Actions.Connection Action + public Actions.Binder Action { get; protected set; @@ -223,7 +211,7 @@ public int onPost(int fSucceeded, int fModified, int fCancelCommand) { int ret = Action.bindPost(fSucceeded, fModified, fCancelCommand); if(Action.reset()) { - uvariable.unsetAll(); + loader.UVars.UnsetAll(); } clientLib.Event.onPost(fSucceeded, fModified, fCancelCommand); @@ -407,7 +395,7 @@ public int solutionOpened(object pUnkReserved, int fNewSolution) var userConfig = ConfigManager.UserConfig; if(config == null || userConfig == null) { - throw new NotFoundException("Config is not ready for loading. User: {0} / Main: {1}", (userConfig != null), (config != null)); + throw new ArgumentException($"Config is not ready for loading. User: {userConfig != null} / Main: {config != null}"); } bool isNew = !config.load(Environment.SolutionPath, Environment.SolutionFileName); @@ -418,7 +406,7 @@ public int solutionOpened(object pUnkReserved, int fNewSolution) UI.Plain.State.Print(config.Data); - Action.Cmd.MSBuild.initPropByDefault(); //LC: #815, #814 + initPropByDefault(Action.Cmd.MSBuild); //LC: #815, #814 OpenedSolution(this, EventArgs.Empty); if(slnEvents == null) { @@ -433,7 +421,7 @@ public int solutionOpened(object pUnkReserved, int fNewSolution) } finally { // Late Sln-Opened (delay calling) ~ When all projects are opened in IDE - lock(_lock) { + lock(sync) { slnEvents.Opened -= slnOpenedLowPriority; slnEvents.Opened += slnOpenedLowPriority; } @@ -501,6 +489,8 @@ protected void init() //} #endif + loader = Bootloader.Init(Environment); + if(Environment.Events != null) { slnEvents = Environment.Events.SolutionEvents; } @@ -514,13 +504,15 @@ protected void init() //TODO: extract all below into new methods. It's valuable for CoreCommand etc. //+ do not forget about ClientLibrary, Provider, etc. - this.Bootloader = new Bootloader(Environment, uvariable); - this.Bootloader.register(); - - Action = new Actions.Connection( - new Actions.Command(Environment, - new Script(Bootloader), - new MSBuild.Parser(Environment, uvariable)) + Action = new Actions.Binder + ( + new Actions.Command + ( + Environment, + loader.Soba, + loader.Soba.EvMSBuild + ), + loader.Soba ); } @@ -543,10 +535,45 @@ protected void configure(ISettings cfg) protected void refreshComponents() { - if(this.Bootloader == null || AppSettings.CfgManager.Config == null) { + if(loader == null || AppSettings.CfgManager.Config == null) { + Log.Debug("Changing of activation has been ignored."); return; } - this.Bootloader.updateActivation(AppSettings.CfgManager.Config.Data); + + var data = AppSettings.CfgManager.Config.Data; + + foreach(IComponent c in loader.Soba.Registered) { + if(data.Components == null || data.Components.Length < 1) { + //c.Enabled = true; + continue; + } + + var found = data.Components.Where(p => p.ClassName == c.GetType().Name).FirstOrDefault(); + if(found == null) { + continue; + } + +#if DEBUG + if(c.Enabled != found.Enabled) { + Log.Trace($"Bootloader - Component '{found.ClassName}': Changing of activation status '{c.Enabled}' -> '{found.Enabled}'"); + } +#endif + c.Enabled = found.Enabled; + } + } + + /// + /// To initialize properties by default for project. + /// + protected virtual void initPropByDefault(IEvMSBuild msbuild) + { + IAppSettings app = AppSettings._; + const string _PFX = AppSettings.APP_NAME_SHORT; + + msbuild.SetGlobalProperty(AppSettings.APP_NAME, vsSBE.Version.numberWithRevString); + msbuild.SetGlobalProperty($"{_PFX}_CommonPath", app.CommonPath); + msbuild.SetGlobalProperty($"{_PFX}_LibPath", app.LibPath); + msbuild.SetGlobalProperty($"{_PFX}_WorkPath", app.WorkPath); } protected void attachCommandEvents() @@ -557,7 +584,7 @@ protected void attachCommandEvents() } cmdEvents = Environment.Events.CommandEvents; // protection from garbage collector - lock(_lock) { + lock(sync) { detachCommandEvents(); cmdEvents.BeforeExecute += _cmdBeforeExecute; cmdEvents.AfterExecute += _cmdAfterExecute; @@ -570,7 +597,7 @@ protected void detachCommandEvents() return; } - lock(_lock) { + lock(sync) { cmdEvents.BeforeExecute -= _cmdBeforeExecute; cmdEvents.AfterExecute -= _cmdAfterExecute; } @@ -582,7 +609,7 @@ protected void detachCommandEvents() /// private void slnOpenedLowPriority() { - lock(_lock) + lock(sync) { if(slnEvents != null) { slnEvents.Opened -= slnOpenedLowPriority; diff --git a/vsSolutionBuildEvent/API/IEventLevel.cs b/vsSolutionBuildEvent/API/IEventLevel.cs index 19fb651a..8e668849 100644 --- a/vsSolutionBuildEvent/API/IEventLevel.cs +++ b/vsSolutionBuildEvent/API/IEventLevel.cs @@ -16,8 +16,8 @@ */ using System; +using net.r_eg.SobaScript; using net.r_eg.vsSBE.Configuration; -using net.r_eg.vsSBE.SBEScripts; namespace net.r_eg.vsSBE.API { @@ -33,11 +33,6 @@ public interface IEventLevel: Bridge.IEvent, Bridge.IBuild /// event EventHandler ClosedSolution; - /// - /// Loader of components - /// - IBootloader Bootloader { get; } - /// /// Used Environment /// @@ -46,7 +41,7 @@ public interface IEventLevel: Bridge.IEvent, Bridge.IBuild /// /// Binder of action /// - Actions.Connection Action { get; } + Actions.Binder Action { get; } /// /// Manager of configurations. diff --git a/vsSolutionBuildEvent/Actions/Action.cs b/vsSolutionBuildEvent/Actions/Action.cs index 61bd012a..810aa58b 100644 --- a/vsSolutionBuildEvent/Actions/Action.cs +++ b/vsSolutionBuildEvent/Actions/Action.cs @@ -15,7 +15,8 @@ * along with this program. If not, see . */ -using System; +using net.r_eg.SobaScript.Z.Ext; +using net.r_eg.SobaScript.Z.Ext.IO; using net.r_eg.vsSBE.Events; namespace net.r_eg.vsSBE.Actions @@ -27,6 +28,8 @@ public abstract class Action: IAction /// protected ICommand cmd; + protected IExer exer; + /// /// Process for specified event. /// @@ -41,10 +44,15 @@ public abstract class Action: IAction /// Formatted command to shell. public virtual void shell(ISolutionEvent evt, string cmd) { - Log.Info("Prepared command: '{0}'", cmd); - - HProcess p = new HProcess(Settings.WPath); - p.useShell(cmd, evt.Id, evt.Process.Waiting, evt.Process.Hidden, evt.Process.TimeLimit); + Log.Info($"Prepared command: '{cmd}'"); + exer.UseShell + ( + cmd, + evt.Id, + evt.Process.Waiting, + evt.Process.Hidden, + evt.Process.TimeLimit + ); } /// @@ -56,26 +64,37 @@ public virtual void shell(ISolutionEvent evt, string cmd) public virtual string parse(ISolutionEvent evt, string data) { if(evt.SupportSBEScripts) { - data = cmd.SBEScript.parse(data, evt.SupportMSBuild); + data = cmd.SBEScript.Eval(data, evt.SupportMSBuild); } if(evt.SupportMSBuild) { - data = cmd.MSBuild.parse(data); + data = cmd.MSBuild.Eval(data); } return data; } /// - public Action(ICommand cmd) + protected Action(ICommand cmd) { this.cmd = cmd; + + if(Bootloader._?.Soba.GetComponent(typeof(FileComponent)) is FileComponent fc) { + exer = fc.Exer; + return; + } + + Log.Trace("Use new Exer instead of FileComponent"); + exer = new Exer(Settings.WPath, new EncDetector()); + + Settings._.WorkPathUpdated += + (object sender, DataArgs e) => exer.BasePath = e.Data; } protected string treatNewlineAs(string str, string data) { - if(String.IsNullOrEmpty(data)) { - return String.Empty; + if(string.IsNullOrEmpty(data)) { + return string.Empty; } return data.Trim(new char[]{ '\r', '\n' }).Replace("\r", "").Replace("\n", str); } diff --git a/vsSolutionBuildEvent/Actions/ActionCSharp.cs b/vsSolutionBuildEvent/Actions/ActionCSharp.cs index 93e2ef79..e8a49e1d 100644 --- a/vsSolutionBuildEvent/Actions/ActionCSharp.cs +++ b/vsSolutionBuildEvent/Actions/ActionCSharp.cs @@ -23,6 +23,8 @@ using System.Reflection; using System.Text; using Microsoft.CSharp; +using net.r_eg.SobaScript.Exceptions; +using net.r_eg.SobaScript.Z.Ext.Extensions; using net.r_eg.vsSBE.Configuration.User; using net.r_eg.vsSBE.Events; using net.r_eg.vsSBE.Exceptions; @@ -54,10 +56,7 @@ public class ActionCSharp: Action, IAction /// /// Where to look cache. /// - protected string BasePathToCache - { - get { return Settings.WPath; } - } + protected string BasePathToCache => Settings.WPath; /// /// Generate a temporary AssemblyInfo. @@ -87,12 +86,6 @@ public void Dispose() } } - /// - /// object synch. - /// - private Object _lock = new Object(); - - /// /// Process for specified event. /// @@ -248,7 +241,7 @@ protected Type load(string file, string find = null) } if(!File.Exists(file)) { - throw new MismatchException("oops., something went wrong... while we thought, cache '{0}' disappeared. Try again.", file); + throw new MismatchException($"oops., something went wrong... while we thought, cache '{file}' disappeared. Try again."); } // into memory without blocking - it's important for CSharpCodeProvider with GenerateInMemory = false @@ -302,7 +295,7 @@ protected CompilerResults onlyCompile(ISolutionEvent evt) string command = cfg.Command; if(String.IsNullOrWhiteSpace(command)) { - throw new InvalidArgumentException("[Compiler] code is not found. abort;"); + throw new ArgumentException("[Compiler] code is not found. abort;"); } command = parse(evt, command); @@ -367,12 +360,20 @@ protected CompilerResults toBinary(string source, CompilerParameters parameters, } Log.Trace("[Compiler] use as list of files with source code."); - if(String.IsNullOrEmpty(hash)) { - return provider.CompileAssemblyFromFile(parameters, filesFromCommand(source).ExtractFiles()); + if(string.IsNullOrEmpty(hash)) + { + return provider.CompileAssemblyFromFile( + parameters, + filesFromCommand(source).ExtractFiles(Settings.WPath) + ); } - using(TempAssemblyInfo f = new TempAssemblyInfo(hash)) { - return provider.CompileAssemblyFromFile(parameters, filesFromCommand(String.Format("{0}\n{1}", source, f.FullPath)).ExtractFiles()); + using(TempAssemblyInfo f = new TempAssemblyInfo(hash)) + { + return provider.CompileAssemblyFromFile( + parameters, + filesFromCommand($"{source}\n{f.FullPath}").ExtractFiles(Settings.WPath) + ); } } @@ -389,7 +390,7 @@ protected string[] constructReferences(IModeCSharp cfg, bool msbuild) { return cfg.References .Where(r => !String.IsNullOrEmpty(r)) - .Select(r => (msbuild)? cmd.MSBuild.parse(r) : r) + .Select(r => (msbuild)? cmd.MSBuild.Eval(r) : r) .ToArray(); } @@ -398,7 +399,7 @@ protected string[] constructReferences(IModeCSharp cfg, bool msbuild) .Where(r => !String.IsNullOrEmpty(r)) .Select(r => gac.getPathToAssembly( - (msbuild)? cmd.MSBuild.parse(r) : r, + (msbuild)? cmd.MSBuild.Eval(r) : r, true ) ) @@ -463,7 +464,7 @@ private string outputCacheFile(ISolutionEvent evt) string path = (cfg.OutputPath)?? String.Empty; if(evt.SupportMSBuild) { - path = cmd.MSBuild.parse(path); + path = cmd.MSBuild.Eval(path); } return Path.Combine(BasePathToCache, path, fileName(evt)); diff --git a/vsSolutionBuildEvent/Actions/ActionInterpreter.cs b/vsSolutionBuildEvent/Actions/ActionInterpreter.cs index 8a4cd9aa..3dbadd58 100644 --- a/vsSolutionBuildEvent/Actions/ActionInterpreter.cs +++ b/vsSolutionBuildEvent/Actions/ActionInterpreter.cs @@ -16,6 +16,7 @@ */ using System.Linq; +using net.r_eg.SobaScript.Exceptions; using net.r_eg.vsSBE.Events; using net.r_eg.vsSBE.Exceptions; @@ -34,7 +35,7 @@ public class ActionInterpreter: Action, IAction public override bool process(ISolutionEvent evt) { if(((IModeInterpreter)evt.Mode).Handler.Trim().Length < 1) { - throw new NotFoundException("Interpreter: Handler is empty or not selected."); + throw new CompilerException("Interpreter: Handler is empty or not selected."); } string script = ((IModeInterpreter)evt.Mode).Command; @@ -60,7 +61,7 @@ public override bool process(ISolutionEvent evt) string handler = ((IModeInterpreter)evt.Mode).Handler; if(evt.SupportMSBuild) { - handler = cmd.MSBuild.parse(handler); + handler = cmd.MSBuild.Eval(handler); } shell(evt, string.Format("{0} {1}", handler, script)); diff --git a/vsSolutionBuildEvent/Actions/ActionTargets.cs b/vsSolutionBuildEvent/Actions/ActionTargets.cs index 59094ed8..6d6d0c00 100644 --- a/vsSolutionBuildEvent/Actions/ActionTargets.cs +++ b/vsSolutionBuildEvent/Actions/ActionTargets.cs @@ -15,7 +15,6 @@ * along with this program. If not, see . */ -using System; using System.Collections.Generic; using System.IO; using Microsoft.Build.Construction; @@ -84,11 +83,12 @@ public override bool process(ISolutionEvent evt) string command = ((IModeTargets)evt.Mode).Command; ProjectRootElement root = getXml(parse(evt, command)); - BuildRequestData request = new BuildRequestData( - new ProjectInstance(root, propertiesByDefault(evt), root.ToolsVersion, ProjectCollection.GlobalProjectCollection), - new string[] { ENTRY_POINT }, - new HostServices() - ); + var request = new BuildRequestData + ( + new ProjectInstance(root, propertiesByDefault(evt), root.ToolsVersion, ProjectCollection.GlobalProjectCollection), + new string[] { ENTRY_POINT }, + new HostServices() + ); // holy hedgehogs... @@ -141,34 +141,34 @@ protected ProjectRootElement getXml(string data) /// protected bool build(BuildManager manager, BuildRequestData request, bool silent = true) { - BuildResult result = manager.Build(new BuildParameters() - { - //MaxNodeCount = 12, - Loggers = new List() { - new MSBuildLogger() { - Silent = silent - } - } - }, - request); - - return (result.OverallResult == BuildResultCode.Success); + BuildResult result = manager.Build + ( + new BuildParameters() + { + //MaxNodeCount = 12, + Loggers = new List() { + new MSBuildLogger() { + Silent = silent + } + } + }, + request + ); + + return result.OverallResult == BuildResultCode.Success; } protected Dictionary propertiesByDefault(ISolutionEvent evt) - { - Dictionary prop = new Dictionary(cmd.Env.getProject(null).GlobalProperties); - - prop.Add(PropertyNames.PRJ_NAME, String.Format("_{0}", evt.Name)); - prop.Add("ActionName", evt.Name); - prop.Add("BuildType", cmd.Env.BuildType.ToString()); - prop.Add("EventType", cmd.EventType.ToString()); - prop.Add("SupportMSBuild", evt.SupportMSBuild.ToString()); - prop.Add("SupportSBEScripts", evt.SupportSBEScripts.ToString()); - prop.Add("SolutionActiveCfg", cmd.Env.SolutionActiveCfgString); - prop.Add("StartupProject", cmd.Env.StartupProjectString); - - return prop; - } + => new Dictionary(cmd.Env.getProject(null).GlobalProperties) + { + { PropertyNames.PRJ_NAME, $"_{evt.Name}" }, + { "ActionName", evt.Name }, + { "BuildType", cmd.Env.BuildType.ToString() }, + { "EventType", cmd.EventType.ToString() }, + { "SupportMSBuild", evt.SupportMSBuild.ToString() }, + { "SupportSBEScripts", evt.SupportSBEScripts.ToString() }, + { "SolutionActiveCfg", cmd.Env.SolutionActiveCfgString }, + { "StartupProject", cmd.Env.StartupProjectString } + }; } } diff --git a/vsSolutionBuildEvent/Actions/Connection.cs b/vsSolutionBuildEvent/Actions/Binder.cs similarity index 97% rename from vsSolutionBuildEvent/Actions/Connection.cs rename to vsSolutionBuildEvent/Actions/Binder.cs index ea4b8e5b..465a3c53 100644 --- a/vsSolutionBuildEvent/Actions/Connection.cs +++ b/vsSolutionBuildEvent/Actions/Binder.cs @@ -22,11 +22,13 @@ using Microsoft.VisualStudio; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; +using net.r_eg.SobaScript; +using net.r_eg.SobaScript.Z.VS; +using net.r_eg.SobaScript.Z.VS.Owp; using net.r_eg.vsSBE.Bridge; using net.r_eg.vsSBE.Events; using net.r_eg.vsSBE.Extensions; using net.r_eg.vsSBE.Logger; -using net.r_eg.vsSBE.SBEScripts.Components; using Task = System.Threading.Tasks.Task; namespace net.r_eg.vsSBE.Actions @@ -37,7 +39,7 @@ namespace net.r_eg.vsSBE.Actions /// /// Binder / Coordinator of main routes. /// - public class Connection + public class Binder { /// /// To support the 'execution order' features. @@ -50,11 +52,10 @@ public class Connection /// protected IExecutionOrder current = new ExecutionOrder(); - /// - /// object synch. - /// - private Object _lock = new Object(); - private Object _plock = new Object(); + protected ISobaCLoader cLoader; + + private readonly object sync = new object(); + private readonly object _plock = new object(); /// /// The main handler of commands. @@ -269,7 +270,7 @@ public void bindBuildRaw(string data) /// Name of item pane public void bindBuildRaw(string data, string guid, string item = null) { - OWPItems._.getEW(new OWPIdent() { guid = guid, item = (item)?? Settings._.DefaultOWPItem }).updateRaw(data); //TODO: + OWPItems._.getEW(new OWPIdent() { guid = guid, item = item ?? Settings._.DefaultOWPItem }).updateRaw(data); //TODO: if(!IsAllowActions) { if(!isDisabledAll(SlnEvents.Transmitter)) { @@ -370,14 +371,15 @@ public bool reset() return true; } - public Connection(ICommand cmd) + public Binder(ICommand cmd, ISobaCLoader loader) { - this.Cmd = cmd; + Cmd = cmd ?? throw new ArgumentNullException(nameof(cmd)); + cLoader = loader ?? throw new ArgumentNullException(nameof(loader)); + projects = new Dictionary(); attachLoggingEvent(); } - /// /// Entry point to Errors/Warnings /// @@ -792,7 +794,7 @@ protected bool hasExecutionOrder(ISolutionEvent evt) protected void attachLoggingEvent() { - lock(_lock) { + lock(sync) { detachLoggingEvent(); Log._.Received += onLogging; } @@ -833,12 +835,10 @@ private void onLogging(object sender, MessageArgs e) Thread.CurrentThread.Name = LoggingEvent.IDENT_TH; } - lock(_lock) + lock(sync) { - IComponent component = Cmd.SBEScript.Bootloader.getComponentByType(typeof(OWPComponent)); - if(component != null) { - ((ILogData)component).updateLogData(e.Message, e.Level); - } + var ld = cLoader.GetComponent(typeof(OwpComponent)) as ILogInfo; + ld?.UpdateLogInfo(e.Message, e.Level); foreach(LoggingEvent evt in SlnEvents.Logging) { @@ -847,7 +847,8 @@ private void onLogging(object sender, MessageArgs e) continue; } - try { + try + { if(Cmd.exec(evt, SolutionEventType.Logging)) { Log.Trace("[Logging]: " + evt.Caption); } diff --git a/vsSolutionBuildEvent/Actions/Command.cs b/vsSolutionBuildEvent/Actions/Command.cs index c0f96b11..090df764 100644 --- a/vsSolutionBuildEvent/Actions/Command.cs +++ b/vsSolutionBuildEvent/Actions/Command.cs @@ -20,11 +20,11 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using net.r_eg.EvMSBuild; +using net.r_eg.SobaScript; using net.r_eg.vsSBE.Bridge; using net.r_eg.vsSBE.Events; using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.MSBuild; -using net.r_eg.vsSBE.SBEScripts; namespace net.r_eg.vsSBE.Actions { @@ -38,7 +38,7 @@ public class Command: ICommand /// /// Work with SBE-Scripts /// - public ISBEScript SBEScript + public ISobaScript SBEScript { get; protected set; @@ -47,7 +47,7 @@ public ISBEScript SBEScript /// /// Work with MSBuild /// - public IMSBuild MSBuild + public IEvMSBuild MSBuild { get; protected set; @@ -130,7 +130,7 @@ public bool exec(ISolutionEvent evt) /// Used environment /// Used SBE-Scripts /// Used MSBuild - public Command(IEnvironment env, ISBEScript script, IMSBuild msbuild) + public Command(IEnvironment env, ISobaScript script, IEvMSBuild msbuild) { Env = env; SBEScript = script; @@ -231,7 +231,7 @@ protected bool confirm(ISolutionEvent evt) case System.Windows.Forms.DialogResult.Cancel: { evt.Enabled = false; Settings.CfgManager.Config.save(); - throw new SBEException("Aborted by user"); + throw new UnspecSBEException("Aborted by user"); } } return false; diff --git a/vsSolutionBuildEvent/Actions/DTEOperation.cs b/vsSolutionBuildEvent/Actions/DTEOperation.cs index 410b924a..a7af7d37 100644 --- a/vsSolutionBuildEvent/Actions/DTEOperation.cs +++ b/vsSolutionBuildEvent/Actions/DTEOperation.cs @@ -19,12 +19,10 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using System.Text; +using System.Runtime.InteropServices; using System.Text.RegularExpressions; -using EnvDTE; -using net.r_eg.vsSBE.Actions; +using net.r_eg.EvMSBuild.Exceptions; using net.r_eg.vsSBE.Events; -using net.r_eg.vsSBE.Exceptions; namespace net.r_eg.vsSBE.Actions { @@ -94,21 +92,28 @@ protected TQueue queue public virtual DTEPrepared parse(string line) { - Match m = Regex.Match(line.Trim(), @"^ - ([A-Za-z_0-9.]+) #1 - Command - (?: - \s* - \( - ([^)]+) #2 - Arguments (optional) - \) ## http://msdn.microsoft.com/en-us/library/envdte._dte.executecommand.aspx - \s* - )? - $", RegexOptions.IgnorePatternWhitespace); - - if(!m.Success) { + Match m = Regex.Match + ( + line.Trim(), + @"^ + ([A-Za-z_0-9.]+) #1 - Command + (?: + \s* + \( + ([^)]+) #2 - Arguments (optional) + \) ## http://msdn.microsoft.com/en-us/library/envdte._dte.executecommand.aspx + \s* + )? + $", + RegexOptions.IgnorePatternWhitespace + ); + + if(!m.Success) + { Log.Debug("Operation '{0}' is not correct", line); - throw new IncorrectSyntaxException("prepare failed - '{0}'", line); + throw new IncorrectSyntaxException($"prepare failed - '{line}'"); } + return new DTEPrepared(m.Groups[1].Value, m.Groups[2].Success ? m.Groups[2].Value.Trim() : String.Empty); } @@ -186,7 +191,7 @@ public void exec(Queue commands, bool abortOnFirstError) Log.Debug("DTE: all completed"); Settings._.IgnoreActions = false; if(terminated != null) { - throw new ComponentException(terminated.Message, terminated); + throw new ExternalException(terminated.Message, terminated); } } } @@ -194,7 +199,7 @@ public void exec(Queue commands, bool abortOnFirstError) public virtual void exec(string name, string args = "") { - env.exec(name, args); + env?.exec(name, args); } public void flushQueue() diff --git a/vsSolutionBuildEvent/Actions/HProcess.cs b/vsSolutionBuildEvent/Actions/HProcess.cs deleted file mode 100644 index e31ff8e3..00000000 --- a/vsSolutionBuildEvent/Actions/HProcess.cs +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.Management; -using System.Runtime.InteropServices; -using System.Text; -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.Actions -{ - public class HProcess - { - /// - /// Unspecified identifier for streams. - /// - public readonly Guid STDS = new Guid("{97FC36E2-2751-4CCC-A2EC-80FFB5FAF3C4}"); - - /// - /// Initial directory - /// - protected string initDir; - - /// - /// Container for standard stream data. - /// TODO: - /// - private static Dictionary stdstream = new Dictionary(); - - // CA1060 - internal static class NativeMethods - { - [DllImport("kernel32.dll")] - internal static extern int GetSystemDefaultLCID(); - } - - internal sealed class TStream - { - public string stdout; - public string stderr; - //public string stdin; - } - - /// - /// The current OEM code page from system locale - /// - public static int OEMCodePage - { - get { - CultureInfo inf = CultureInfo.GetCultureInfo(NativeMethods.GetSystemDefaultLCID()); - return inf.TextInfo.OEMCodePage; - } - } - - /// - /// OEM Encoding from system locale - /// - public static Encoding EncodingOEM - { - get - { - if(encodingOEM == null) { - encodingOEM = Encoding.GetEncoding(OEMCodePage); - } - return encodingOEM; - } - } - private static Encoding encodingOEM; - - /// - /// Execute file with arguments. Uses synchronous read operations. - /// TODO: Serial data for stdin. - /// - /// - /// - /// Hide process if true - /// How long to wait the execution, in seconds. 0 value - infinitely - /// - public string run(string file, string args, bool hidden, int timeout = 0) - { - Process p = prepareProcessFor(file, args, hidden); - p.Start(); - wait(p, file, timeout); - - if(!p.StartInfo.RedirectStandardError) { - return String.Empty; - } - - string errors = p.StandardError.ReadToEnd(); - if(errors.Length > 0) { - throw new ComponentException(reEncodeString(errors)); - } - - string ret = reEncodeString(p.StandardOutput.ReadToEnd()); - if(!String.IsNullOrEmpty(ret)) { - ret = ret.TrimEnd(new char[] { '\r', '\n' }); - } - return ret; - } - - /// - /// Execute command with standard command-line interpreter. - /// - /// Command to execute - /// Unique id for streams. - /// Waiting for completion - /// Hiding result - /// How long to wait the execution, in seconds. 0 value - infinitely - public void useShell(string cmd, Guid uid, bool waiting, bool hidden, int timeout = 0) - { - Process p = prepareProcessFor("cmd", $"/C \"{cmd}\"", hidden); - - p.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => - { - if(String.IsNullOrEmpty(e.Data)) { - return; - } - - string sdata = reEncodeString(e.Data); - StreamContainer(uid).stderr = sdata; - - Log.Info("stderr: received '{0}'", sdata.Length); - Log.Warn("The command has been executed with error: `{0}`", sdata); - }; - - p.OutputDataReceived += (object sender, DataReceivedEventArgs e) => - { - if(String.IsNullOrEmpty(e.Data)) { - return; - } - - string sdata = reEncodeString(e.Data); - StreamContainer(uid).stdout = sdata; - - Log.Info("stdout: received '{0}'", sdata.Length); - Log.Info("Result of the command: `{0}`", sdata); - }; - - p.Start(); - - if(p.StartInfo.RedirectStandardOutput) { - p.BeginOutputReadLine(); - } - - if(p.StartInfo.RedirectStandardError) { - p.BeginErrorReadLine(); - } - - if(!waiting) { - return; - } - wait(p, cmd, timeout); - } - - public void useShell(string cmd, bool waiting, bool hidden, int timeout = 0) - { - useShell(cmd, STDS, waiting, hidden, timeout); - } - - internal static string Stdout(Guid id) - { - try { - return StreamContainer(id).stdout; - } - finally { - StreamContainer(id).stdout = null; //TODO: for clients by uid etc. - } - } - - internal static string Stderr(Guid id) - { - try { - return StreamContainer(id).stderr; - } - finally { - StreamContainer(id).stderr = null; - } - } - - /// Initial directory for processes - public HProcess(string directory) - { - initDir = directory; - } - - public HProcess() - { - initDir = Settings.WPath; - } - - /// - /// Preparing instance of the Process - /// - /// Application to start - /// Arguments to use when starting the application - /// Silent mode - /// Prepared instance - protected Process prepareProcessFor(string file, string args, bool hidden) - { - Process p = new Process(); - p.StartInfo.FileName = file; - - p.StartInfo.Arguments = args; - p.StartInfo.UseShellExecute = false; - p.StartInfo.WorkingDirectory = initDir; - - if(!hidden) { - p.StartInfo.WindowStyle = ProcessWindowStyle.Normal; - p.StartInfo.CreateNoWindow = false; - return p; - } - - p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; - p.StartInfo.CreateNoWindow = true; - p.StartInfo.RedirectStandardOutput = true; - p.StartInfo.RedirectStandardError = true; - p.StartInfo.RedirectStandardInput = true; - p.StartInfo.StandardErrorEncoding = - p.StartInfo.StandardOutputEncoding = - EncodingOEM; // by default, and we must to detect a charset for received data later - return p; - } - - /// - /// Destroys process and all its child processes by the pid of parent. - /// - /// - protected void killProcessesFor(int pid) - { - // The Win32_Process WMI class represents a process on an operating system. :: https://msdn.microsoft.com/en-us/library/aa394372%28v=vs.85%29.aspx - ManagementObjectCollection moProcesses = (new ManagementObjectSearcher("SELECT ProcessId FROM Win32_Process WHERE ParentProcessId = " + pid)).Get(); - foreach(ManagementObject moProcess in moProcesses) { - killProcessesFor(Convert.ToInt32(moProcess["ProcessId"])); - } - - Process p = Process.GetProcessById(pid); - if(!p.HasExited) { - Log.Trace("sigkill: -> {0}", pid); - p.Kill(); - } - } - - /// - /// Auto-detector to fixing the encoded string. - /// - /// Data for reencoding - /// Known Encoding for current string - /// Reencoded string with auto-detected charset. - protected virtual string reEncodeString(string str, Encoding from) - { - if(String.IsNullOrEmpty(str)) { - return str; - } - - byte[] bytes = from.GetBytes(str); - - Ude.CharsetDetector cdet = new Ude.CharsetDetector(); - cdet.Feed(bytes, 0, bytes.Length); - cdet.DataEnd(); - - if(cdet.Charset == null) { - Log.Debug("reEncodeString: Problem with detection... use the original"); - return str; - } - Log.Debug("reEncodeString: charset '{0}' confidence: '{1}'", cdet.Charset, cdet.Confidence); - - if(cdet.Confidence < 0.92f) { - Log.Debug("reEncodeString: Confidence < 0.92 /use the original"); - return str; - } - - Encoding to = Encoding.GetEncoding(cdet.Charset); - Log.Debug("reEncodeString: '{0}' -> '{1}'", from.EncodingName, to.EncodingName); - Log.Trace("reEncodeString: original - '{0}'", str); - return to.GetString(bytes); - } - - protected string reEncodeString(string str) - { - if(String.IsNullOrWhiteSpace(str)) { - return String.Empty; - } - return reEncodeString(str, EncodingOEM); - } - - private static TStream StreamContainer(Guid id) - { - if(!stdstream.ContainsKey(id) || stdstream[id] == null) { - stdstream[id] = new TStream(); - } - return stdstream[id]; - } - - private void wait(Process p, string cmd, int timeout) - { - if(p.HasExited) { - return; - } - - Log.Trace($"HProcess: time limit is '{timeout}'sec"); - if(timeout == 0) { - p.WaitForExit(); - return; - } - - p.WaitForExit(timeout * 1000); - if(!p.HasExited) { - Log.Warn($"sigkill for `{cmd}`: limit in {timeout}sec for time is reached. Use any other value or 0 for unlimited time."); - killProcessesFor(p.Id); - } - } - } -} diff --git a/vsSolutionBuildEvent/Actions/ICommand.cs b/vsSolutionBuildEvent/Actions/ICommand.cs index e8ec37d5..56c5aa8d 100644 --- a/vsSolutionBuildEvent/Actions/ICommand.cs +++ b/vsSolutionBuildEvent/Actions/ICommand.cs @@ -16,9 +16,9 @@ */ using System.Runtime.InteropServices; +using net.r_eg.EvMSBuild; +using net.r_eg.SobaScript; using net.r_eg.vsSBE.Events; -using net.r_eg.vsSBE.MSBuild; -using net.r_eg.vsSBE.SBEScripts; namespace net.r_eg.vsSBE.Actions { @@ -28,12 +28,12 @@ public interface ICommand /// /// SBE-Scripts core /// - ISBEScript SBEScript { get; } + ISobaScript SBEScript { get; } /// /// MSBuild core /// - IMSBuild MSBuild { get; } + IEvMSBuild MSBuild { get; } /// /// Used environment diff --git a/vsSolutionBuildEvent/Bootloader.cs b/vsSolutionBuildEvent/Bootloader.cs new file mode 100644 index 00000000..42c18354 --- /dev/null +++ b/vsSolutionBuildEvent/Bootloader.cs @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . +*/ + +using System; +using net.r_eg.SobaScript; +using net.r_eg.SobaScript.Z.Core; +using net.r_eg.SobaScript.Z.Ext; +using net.r_eg.SobaScript.Z.Ext.IO; +using net.r_eg.SobaScript.Z.VS; +using net.r_eg.Varhead; +using net.r_eg.vsSBE.SobaScript.Components; + +namespace net.r_eg.vsSBE +{ + //TODO: new arch for SobaScript + E-MSBuild + internal sealed class Bootloader + { + public static Bootloader _ + { + get; + private set; + } + + public IEnvironment Env + { + get; + private set; + } + + public IUVars UVars + { + get; + private set; + } + + public ISobaScript Soba + { + get; + private set; + } + + public static Bootloader Init(IEnvironment env) + { + if(_ == null) { + _ = new Bootloader(env); + } + return _; + } + + public static ISobaScript Configure(ISobaScript soba, IEnvironment env) + { + if(soba == null) { + throw new ArgumentNullException(nameof(soba)); + } + + IEncDetector detector = new EncDetector(); + + var fc = new FileComponent(soba, detector, new Exer(Settings.WPath, detector)); + var zc = new SevenZipComponent(soba, new SzArchiver(), Settings.WPath); + var nc = new NuGetComponent(soba, Settings.WPath); + + Settings._.WorkPathUpdated += (object sender, DataArgs e) => + { + fc.Exer.BasePath = e.Data; + zc.BasePath = e.Data; + nc.BasePath = e.Data; + }; + + //NOTE: custom order makes sense for vsSBE + + soba.Register(new TryComponent(soba)); + soba.Register(new CommentComponent()); + soba.Register(new BoxComponent(soba)); + soba.Register(new ConditionComponent(soba)); + soba.Register(new UserVariableComponent(soba)); + soba.Register(new OwpComponent(soba, new OwpEnv(env))); + soba.Register(new DteComponent(soba, new DteEnv(env))); + soba.Register(new InternalComponent(soba, env, fc.Exer)); + soba.Register(new EvMSBuildComponent(soba)); + soba.Register(new BuildComponent(soba, new BuildEnv(env))); + soba.Register(new FunctionComponent(soba)); + soba.Register(fc); + soba.Register(nc); + soba.Register(zc); + + return soba; + } + + public static ISobaScript Reset(ISobaScript soba, bool unsetUVars) + { + if(soba == null) { + throw new ArgumentNullException(nameof(soba)); + } + + soba.Unregister(); + + if(unsetUVars) { + soba.UVars.UnsetAll(); + } + + return soba; + } + + public ISobaScript Configure(ISobaScript soba) + => Configure(soba, Env); + + private Bootloader(IEnvironment env) + { + Env = env ?? throw new ArgumentNullException(nameof(env)); + + UVars = new UVars(); + + Soba = Configure( + new Soba(MSBuild.MakeEvaluator(env, UVars), UVars) + ); + } + } +} diff --git a/vsSolutionBuildEvent/BuildEnv.cs b/vsSolutionBuildEvent/BuildEnv.cs new file mode 100644 index 00000000..1e59158d --- /dev/null +++ b/vsSolutionBuildEvent/BuildEnv.cs @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . +*/ + +using System; +using EnvDTE; +using net.r_eg.SobaScript.Exceptions; +using net.r_eg.SobaScript.Z.VS.Build; +using net.r_eg.vsSBE.Actions; + +namespace net.r_eg.vsSBE +{ + internal sealed class BuildEnv: IBuildEnv + { + private IEnvironment env; + private Lazy dteo; + + public string BuildType => env.BuildType.ToString(); + + public bool IsCleanOperation + { + get + { + switch(env.BuildType) + { + case Bridge.BuildType.Clean: + case Bridge.BuildType.CleanCtx: + case Bridge.BuildType.CleanOnlyProject: + case Bridge.BuildType.CleanSelection: { + return true; + } + } + return false; + } + } + + public bool IsOpenedSolution => env.IsOpenedSolution; + + public string SolutionFile => env.SolutionFile; + + public void CancelBuild() => dteo.Value.exec("Build.Cancel"); + + public ISolutionContext GetSolutionContext(object ident) + => new _SlnContext(ident.ToString(), env); + + public BuildEnv(IEnvironment env) + { + this.env = env ?? throw new ArgumentNullException(nameof(env)); + + dteo = new Lazy(() => + new DTEOperation(env, Events.SolutionEventType.General) + ); + } + + private sealed class _SlnContext: ISolutionContext + { + private SolutionContext context; + + public bool IsBuildable + { + get => context.ShouldBuild; + set => context.ShouldBuild = value; + } + + public bool IsDeployable + { + get => context.ShouldDeploy; + set => context.ShouldDeploy = value; + } + + public _SlnContext(string projectName, IEnvironment env) + { + context = getContextByProject(projectName, env); + } + + private SolutionContext getContextByProject(string name, IEnvironment env) + { + if(env?.SolutionActiveCfg == null) { + throw new NotSupportedException("SolutionActiveCfg is disabled for current environment."); + } + + var slnc = env.SolutionActiveCfg.SolutionContexts.GetEnumerator(); + + while(slnc.MoveNext()) + { + var con = (SolutionContext)slnc.Current; + + if(con.ProjectName.Contains(name)) { + return con; + } + } + + throw new NotFoundException(name); + } + } + } +} diff --git a/vsSolutionBuildEvent/Clients/ClientLibrary.cs b/vsSolutionBuildEvent/Clients/ClientLibrary.cs index eb06d136..25717f31 100644 --- a/vsSolutionBuildEvent/Clients/ClientLibrary.cs +++ b/vsSolutionBuildEvent/Clients/ClientLibrary.cs @@ -19,6 +19,7 @@ using System.Collections.Generic; using System.IO; using System.Reflection; +using net.r_eg.MvsSln.Extensions; using net.r_eg.vsSBE.Bridge; using net.r_eg.vsSBE.Extensions; @@ -45,7 +46,7 @@ public string FullName public string Dllpath { get { - return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location).PathFormat(); + return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location).DirectoryPathFormat(); } } diff --git a/vsSolutionBuildEvent/Config.cs b/vsSolutionBuildEvent/Config.cs index 55f3d66f..10bd0f32 100644 --- a/vsSolutionBuildEvent/Config.cs +++ b/vsSolutionBuildEvent/Config.cs @@ -17,13 +17,10 @@ using System; using System.IO; -using System.Linq; using System.Text; +using net.r_eg.MvsSln.Extensions; using net.r_eg.vsSBE.Configuration; using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.Extensions; -using net.r_eg.vsSBE.SBEScripts.Components; namespace net.r_eg.vsSBE { @@ -90,7 +87,7 @@ public void load(ISolutionEvents data) /// true value if loaded from existing file, otherwise loaded as new. public bool load(string link) { - Link = link.PathFormat(); + Link = link.DirectoryPathFormat(); return load(Link, null); } @@ -153,7 +150,7 @@ protected virtual bool loadByLink(string link) { Data = deserialize(stream); if(Data == null) { - throw new SBEException("file is empty"); + throw new UnspecSBEException("file is empty"); } compatibility(stream); } diff --git a/vsSolutionBuildEvent/Configuration/User/Manager.cs b/vsSolutionBuildEvent/Configuration/User/Manager.cs index 26342124..08795155 100644 --- a/vsSolutionBuildEvent/Configuration/User/Manager.cs +++ b/vsSolutionBuildEvent/Configuration/User/Manager.cs @@ -15,14 +15,14 @@ * along with this program. If not, see . */ -using net.r_eg.vsSBE.Exceptions; +using System; namespace net.r_eg.vsSBE.Configuration.User { /// /// Manager of accessing to remote value. /// - public class Manager: IManager + internal class Manager: IManager { /// /// Unspecified raw value. @@ -33,14 +33,13 @@ public object Value { checkOnNull(); - if(value.Type == LinkType.CacheHeader) - { + //if(value.Type == LinkType.CacheHeader) + //{ if(!data.Cache.ContainsKey(value.Guid)) { data.Cache[value.Guid] = new Cache(); } return data.Cache[value.Guid]; - } - throw new InvalidArgumentException("Configuration Manager: not supported type '{0}'", value.Type); + //} } } @@ -112,11 +111,11 @@ public Manager(IUserValue value) protected void checkOnNull() { if(data == null) { - throw new InvalidArgumentException("Configuration Manager: container is not initialized."); + throw new ArgumentException("Configuration Manager: container is not initialized."); } if(value == null) { - throw new InvalidArgumentException("Configuration Manager: IUserValue value is not initialized."); + throw new ArgumentException("Configuration Manager: IUserValue value is not initialized."); } } } diff --git a/vsSolutionBuildEvent/DteEnv.cs b/vsSolutionBuildEvent/DteEnv.cs new file mode 100644 index 00000000..3d6120ac --- /dev/null +++ b/vsSolutionBuildEvent/DteEnv.cs @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . +*/ + +using System; +using net.r_eg.SobaScript.Z.VS.Dte; +using net.r_eg.vsSBE.Actions; + +namespace net.r_eg.vsSBE +{ + internal sealed class DteEnv: IDteEnv + { + private IEnvironment env; + private Lazy dteo; + + private EnvDTE.CommandEvents cmdEvents; + + private readonly object sync = new object(); + + /// + /// Ability of work with DTE Commands. + /// + public bool IsAvaialbleDteCmd => env.Events != null; + + /// + /// The last received command from EnvDTE. + /// + public IDteCommand LastCmd + { + get; + private set; + } = new _DteCommand(); + + /// + /// Execute command through EnvDTE. + /// + /// + public void Execute(string cmd) + => dteo.Value.exec(new string[] { cmd }, false); + + public void Dispose() => DetachCommandEvents(); + + public DteEnv(IEnvironment env) + { + this.env = env ?? throw new ArgumentNullException(nameof(env)); + + dteo = new Lazy(() => + new DTEOperation(env, Events.SolutionEventType.General) + ); + + AttachCommandEvents(); + } + + private void AttachCommandEvents() + { + if(!IsAvaialbleDteCmd || env.Events.CommandEvents == null) + { + Log.Info("CommandEvents: aren't available for current context."); + return; //this can be for emulated DTE2 context + } + + cmdEvents = env.Events.CommandEvents; + + lock(sync) + { + DetachCommandEvents(); + cmdEvents.BeforeExecute += OnCommandEventBefore; + cmdEvents.AfterExecute += OnCommandEventAfter; + } + } + + private void DetachCommandEvents() + { + if(cmdEvents == null) { + return; + } + + cmdEvents.BeforeExecute -= OnCommandEventBefore; + cmdEvents.AfterExecute -= OnCommandEventAfter; + } + + private void OnCommandEventBefore(string guid, int id, object customIn, object customOut, ref bool cancelDefault) + => CommandEvent(true, guid, id, customIn, customOut); + + private void OnCommandEventAfter(string guid, int id, object customIn, object customOut) + => CommandEvent(false, guid, id, customIn, customOut); + + private void CommandEvent(bool pre, string guid, int id, object customIn, object customOut) + { + LastCmd = new _DteCommand() + { + Guid = guid, + Id = id, + CustomIn = customIn, + CustomOut = customOut, + Pre = pre + }; + } + + private sealed class _DteCommand: IDteCommand + { + public string Guid { get; set; } + + public int Id { get; set; } + + public object CustomIn { get; set; } + + public object CustomOut { get; set; } + + public bool Cancel { get; set; } + + public bool Pre { get; set; } + } + } +} diff --git a/vsSolutionBuildEvent/EncDetector.cs b/vsSolutionBuildEvent/EncDetector.cs new file mode 100644 index 00000000..56a4f1c2 --- /dev/null +++ b/vsSolutionBuildEvent/EncDetector.cs @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . +*/ + +using System; +using System.IO; +using System.Text; +using net.r_eg.SobaScript.Z.Ext; + +namespace net.r_eg.vsSBE +{ + internal sealed class EncDetector: IEncDetector + { + /// + /// Detects encoding for specified stream. + /// + /// Input stream. + /// Detected confidence. + /// null if can't be detected. + public Encoding Detect(Stream stream, out float confidence) + { + confidence = 0; + + if(stream == null) { + return null; + } + + Ude.CharsetDetector cdet = new Ude.CharsetDetector(); + cdet.Feed(stream); + cdet.DataEnd(); + + if(cdet.Charset == null) { + return null; + } + + confidence = cdet.Confidence; + + Log.Debug($"Detected charset '{cdet.Charset}' confidence: '{cdet.Confidence}'"); + return Encoding.GetEncoding(cdet.Charset); + } + + /// + /// Detects encoding for specified stream. + /// + /// Input stream. + /// null if can't be detected. + public Encoding Detect(Stream stream) + => Detect(stream, out float confidence); + + /// + /// Try to fix the wrong encoded string. + /// + /// Input data. + /// Known information about bytes. + /// To limit accepted confidence. + /// Returns null if detected confidence less than input limit. Otherwise, re-encoded string. + public string FixEncoding(string input, Encoding container, float confidence = 0.92f) + { + if(string.IsNullOrWhiteSpace(input)) { + return input; + } + + if(container == null) { + throw new ArgumentNullException(nameof(container)); + } + + byte[] bytes = container.GetBytes(input); + + var cdet = new Ude.CharsetDetector(); + cdet.Feed(bytes, 0, bytes.Length); + cdet.DataEnd(); + + if(cdet.Charset == null) { + return null; + } + + Log.Debug($"{nameof(FixEncoding)}: charset '{cdet.Charset}' confidence: '{cdet.Confidence}'"); + + if(cdet.Confidence < confidence) { + Log.Debug($"{nameof(FixEncoding)}: Confidence < {confidence}"); + return null; + } + + Encoding to = Encoding.GetEncoding(cdet.Charset); + + Log.Debug($"ReEncodeString: '{container.EncodingName}' -> '{to.EncodingName}'"); + Log.Trace($"ReEncodeString: original - '{input}'"); + return to.GetString(bytes); + } + } +} diff --git a/vsSolutionBuildEvent/EnvAbstract.cs b/vsSolutionBuildEvent/EnvAbstract.cs index 2dd38646..5cb11066 100644 --- a/vsSolutionBuildEvent/EnvAbstract.cs +++ b/vsSolutionBuildEvent/EnvAbstract.cs @@ -20,8 +20,8 @@ using System.Linq; using net.r_eg.MvsSln; using net.r_eg.MvsSln.Core; +using net.r_eg.MvsSln.Exceptions; using net.r_eg.vsSBE.API.Commands; -using net.r_eg.vsSBE.Exceptions; using BuildType = net.r_eg.vsSBE.Bridge.BuildType; using EProject = Microsoft.Build.Evaluation.Project; using ProjectItem = net.r_eg.MvsSln.Core.ProjectItem; @@ -84,6 +84,16 @@ protected IXProjectEnv SlnEnv } protected IXProjectEnv _slnEnv; + /// + /// Get Project instance for work with data inside specified scope. + /// + /// Abstract identifier of the specified scope. It can be a GUID, or FullPath, or project name, etc. + /// Expected the instance that is associated with the identifier or any default instance if not found any related to pushed ident. + public EProject GetProject(object ident) + { + return getProject(ident?.ToString()); + } + /// /// Get instance of the Build.Evaluation.Project for accessing to properties etc. /// diff --git a/vsSolutionBuildEvent/Environment.cs b/vsSolutionBuildEvent/Environment.cs index 49c0ceee..c90981a7 100644 --- a/vsSolutionBuildEvent/Environment.cs +++ b/vsSolutionBuildEvent/Environment.cs @@ -21,6 +21,7 @@ using System.Linq; using EnvDTE80; using Microsoft.VisualStudio.Shell.Interop; +using net.r_eg.EvMSBuild; using net.r_eg.MvsSln; using net.r_eg.MvsSln.Core; using net.r_eg.MvsSln.Extensions; @@ -35,7 +36,7 @@ namespace net.r_eg.vsSBE { // TODO: more unified integration with IsolatedEnv /EnvDTE to MvsSln as possible // ~such as full processing by MvsSln through information about .sln file from EnvDTE. - public class Environment: EnvAbstract, IEnvironment, IEnvironmentExt + public class Environment: EnvAbstract, IEnvironment, IEnvironmentExt, IEvEnv { [Obsolete("Use " + nameof(PropertyNames), false)] public const string PROP_UNAV_STRING = PropertyNames.UNDEFINED; @@ -275,6 +276,17 @@ protected IEnumerable DTEProjectsRaw } } + /// + /// An unified unscoped and out of Project instance the property value by its name. + /// Remarks: Any property values cannot be null. + /// + /// Property name. + /// Found non-null property value or null if not. + public string GetMutualPropValue(string name) + { + return getSolutionProperty(name); + } + /// /// To update the Project Name by default aka "StartUp Project". /// diff --git a/vsSolutionBuildEvent/Exceptions/CompilerException.cs b/vsSolutionBuildEvent/Exceptions/CompilerException.cs index 56fa7ecc..aa45fc05 100644 --- a/vsSolutionBuildEvent/Exceptions/CompilerException.cs +++ b/vsSolutionBuildEvent/Exceptions/CompilerException.cs @@ -21,22 +21,16 @@ namespace net.r_eg.vsSBE.Exceptions { [Serializable] - public class CompilerException: SBEException + public class CompilerException: UnspecSBEException { - public CompilerException(string message) - : base(message) - { - - } - public CompilerException(CompilerError error) - : base(error.ToString()) + : base(error.ToString(), error) { } - public CompilerException(string message, params object[] args) - : base(message, args) + public CompilerException(string message) + : base(message) { } diff --git a/vsSolutionBuildEvent/Exceptions/ComponentException.cs b/vsSolutionBuildEvent/Exceptions/ComponentException.cs deleted file mode 100644 index 59244050..00000000 --- a/vsSolutionBuildEvent/Exceptions/ComponentException.cs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.Exceptions -{ - [Serializable] - public class ComponentException: SBEException - { - public ComponentException(string message) - : base(message) - { - - } - - public ComponentException(string message, Exception innerException) - : base(message, innerException) - { - - } - - public ComponentException(string message, params object[] args) - : base(message, args) - { - - } - - public ComponentException(string message, Exception innerException, params object[] args) - : base(message, innerException, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/Exceptions/IncorrectSyntaxException.cs b/vsSolutionBuildEvent/Exceptions/IncorrectSyntaxException.cs deleted file mode 100644 index 26fb777e..00000000 --- a/vsSolutionBuildEvent/Exceptions/IncorrectSyntaxException.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.Exceptions -{ - [Serializable] - public class IncorrectSyntaxException: SBEException - { - public IncorrectSyntaxException(string message) - : base(message) - { - - } - - public IncorrectSyntaxException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/Exceptions/InvalidArgumentException.cs b/vsSolutionBuildEvent/Exceptions/InvalidArgumentException.cs deleted file mode 100644 index d666ca27..00000000 --- a/vsSolutionBuildEvent/Exceptions/InvalidArgumentException.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.Exceptions -{ - [Serializable] - public class InvalidArgumentException: SBEException - { - public InvalidArgumentException(string message) - : base(message) - { - - } - - public InvalidArgumentException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/Exceptions/LimitException.cs b/vsSolutionBuildEvent/Exceptions/LimitException.cs deleted file mode 100644 index cc20c022..00000000 --- a/vsSolutionBuildEvent/Exceptions/LimitException.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.Exceptions -{ - [Serializable] - public class LimitException: SBEException - { - public LimitException(string message) - : base(message) - { - - } - - public LimitException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/Exceptions/MismatchException.cs b/vsSolutionBuildEvent/Exceptions/MismatchException.cs deleted file mode 100644 index 17fb00a4..00000000 --- a/vsSolutionBuildEvent/Exceptions/MismatchException.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.Exceptions -{ - [Serializable] - public class MismatchException: SBEException - { - public MismatchException(string message) - : base(message) - { - - } - - public MismatchException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/Exceptions/NotFoundException.cs b/vsSolutionBuildEvent/Exceptions/NotFoundException.cs deleted file mode 100644 index f081fb92..00000000 --- a/vsSolutionBuildEvent/Exceptions/NotFoundException.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.Exceptions -{ - [Serializable] - public class NotFoundException: SBEException - { - public NotFoundException(string message) - : base(message) - { - - } - - public NotFoundException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/Exceptions/SBEException.cs b/vsSolutionBuildEvent/Exceptions/UnspecSBEException.cs similarity index 58% rename from vsSolutionBuildEvent/Exceptions/SBEException.cs rename to vsSolutionBuildEvent/Exceptions/UnspecSBEException.cs index 25aad629..b353b700 100644 --- a/vsSolutionBuildEvent/Exceptions/SBEException.cs +++ b/vsSolutionBuildEvent/Exceptions/UnspecSBEException.cs @@ -16,44 +16,44 @@ */ using System; +using System.Runtime.Serialization; +using System.Security.Permissions; namespace net.r_eg.vsSBE.Exceptions { [Serializable] - public class SBEException: NotSupportedException + public class UnspecSBEException: Exception { - public SBEException() - { - - } + public readonly object value; - public SBEException(string message) - : base(message) + [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(SerializationInfo info, StreamingContext context) { - + base.GetObjectData(info, context); + info.AddValue(nameof(value), value); } - public SBEException(string message, Exception innerException) - : base(message, innerException) + public UnspecSBEException() { } - public SBEException(string message, params object[] args) - : base(format(ref message, args)) + public UnspecSBEException(string message) + : base(message) { } - public SBEException(string message, Exception innerException, params object[] args) - : base(format(ref message, args), innerException) + public UnspecSBEException(string message, object value) + : base(message) { - + this.value = value; } - protected static string format(ref string message, params object[] args) + public UnspecSBEException(string message, Exception innerException) + : base(message, innerException) { - return String.Format(message, args); + } } -} +} \ No newline at end of file diff --git a/vsSolutionBuildEvent/Extensions/ArrayExtension.cs b/vsSolutionBuildEvent/Extensions/ArrayExtension.cs index 62c29f41..471df640 100644 --- a/vsSolutionBuildEvent/Extensions/ArrayExtension.cs +++ b/vsSolutionBuildEvent/Extensions/ArrayExtension.cs @@ -108,28 +108,5 @@ public static string BytesToHexView(this byte[] data) } return ret.ToString(); } - - /// - /// Extracts absolute paths to files with mask (*.*, *.dll, ..) - /// - /// List of files. - /// Base path. - /// - public static string[] ExtractFiles(this string[] files, string path = null) - { - List ret = new List(); - foreach(string file in files) - { - string mask = Path.GetFileName(file); - string fullname = Path.Combine(path ?? Settings.WPath, file); - - if(mask.IndexOf('*') != -1) { - ret.AddRange(Directory.GetFiles(Path.GetDirectoryName(fullname), mask)); - continue; - } - ret.Add(fullname); - } - return ret.ToArray(); - } } } diff --git a/vsSolutionBuildEvent/Extensions/ObjectExtension.cs b/vsSolutionBuildEvent/Extensions/ObjectExtension.cs index d020c9b2..c489fd00 100644 --- a/vsSolutionBuildEvent/Extensions/ObjectExtension.cs +++ b/vsSolutionBuildEvent/Extensions/ObjectExtension.cs @@ -162,19 +162,6 @@ public static bool IsNullOrEmptyString(this object obj) return (obj == null || obj is string && (string)obj == String.Empty); } - /// - /// Convert complex object to system. - /// - /// - /// - public static object ToSystemObject(this object data) - { - if(data is Newtonsoft.Json.Linq.JArray) { - return (object)((Newtonsoft.Json.Linq.JArray)data).ToObject(typeof(object[])); - } - return data; - } - /// /// Calculate MD5 hash from object. /// diff --git a/vsSolutionBuildEvent/Extensions/StringExtension.cs b/vsSolutionBuildEvent/Extensions/StringExtension.cs index 1227643e..f267f5f1 100644 --- a/vsSolutionBuildEvent/Extensions/StringExtension.cs +++ b/vsSolutionBuildEvent/Extensions/StringExtension.cs @@ -52,16 +52,6 @@ public static string SHA1Hash(this string str) } } - /// - /// Formatting of the path to directory. - /// - /// - /// - public static string PathFormat(this string path) - { - return path.DirectoryPathFormat(); - } - /// /// BSTR. Directory where visual studio executable was installed. /// http://technet.microsoft.com/en-us/microsoft.visualstudio.shell.interop.__vsspropid%28v=vs.71%29.aspx diff --git a/vsSolutionBuildEvent/IAppSettings.cs b/vsSolutionBuildEvent/IAppSettings.cs index 0b80ef4b..617ec7ce 100644 --- a/vsSolutionBuildEvent/IAppSettings.cs +++ b/vsSolutionBuildEvent/IAppSettings.cs @@ -31,6 +31,11 @@ internal interface IAppSettings /// event EventHandler> DebugModeUpdated; + /// + /// When IAppSettings.WorkPath was updated. + /// + event EventHandler> WorkPathUpdated; + /// /// Debug mode for application. /// @@ -85,7 +90,7 @@ internal interface IAppSettings /// /// OWP item name by default. /// - string DefaultOWPItem { get; set; } + string DefaultOWPItem { get; } /// /// Updates working path for library. diff --git a/vsSolutionBuildEvent/IEnvironment.cs b/vsSolutionBuildEvent/IEnvironment.cs index 47a55cce..147377ae 100644 --- a/vsSolutionBuildEvent/IEnvironment.cs +++ b/vsSolutionBuildEvent/IEnvironment.cs @@ -17,6 +17,7 @@ using System.Collections.Generic; using System.Runtime.InteropServices; +using net.r_eg.EvMSBuild; using net.r_eg.vsSBE.API.Commands; using net.r_eg.vsSBE.Bridge; using DProject = EnvDTE.Project; @@ -25,7 +26,7 @@ namespace net.r_eg.vsSBE { [Guid("27F04A53-A0B9-431B-83FE-827AC09FB127")] - public interface IEnvironment + public interface IEnvironment: IEvEnv { /// /// List of EnvDTE projects. diff --git a/vsSolutionBuildEvent/ILogData.cs b/vsSolutionBuildEvent/ILogData.cs deleted file mode 100644 index 4c19a426..00000000 --- a/vsSolutionBuildEvent/ILogData.cs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Runtime.InteropServices; - -namespace net.r_eg.vsSBE -{ - [Guid("471026C2-9781-407F-A011-498B82D55623")] - public interface ILogData - { - /// - /// - void updateLogData(string message, string level); - } -} diff --git a/vsSolutionBuildEvent/IsolatedEnv.cs b/vsSolutionBuildEvent/IsolatedEnv.cs index b3c96dfc..4fe2ea41 100644 --- a/vsSolutionBuildEvent/IsolatedEnv.cs +++ b/vsSolutionBuildEvent/IsolatedEnv.cs @@ -19,6 +19,7 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Build.Evaluation; +using net.r_eg.EvMSBuild; using net.r_eg.MvsSln; using net.r_eg.MvsSln.Core; using net.r_eg.MvsSln.Extensions; @@ -33,7 +34,7 @@ namespace net.r_eg.vsSBE /// /// Isolated environment for work without DTE /// - public class IsolatedEnv: EnvAbstract, IEnvironment + public class IsolatedEnv: EnvAbstract, IEnvironment, IEvEnv { protected IDictionary slnProperties = new Dictionary(); @@ -188,6 +189,17 @@ public IOW OutputWindowPane get => __disabled(nameof(OutputWindowPane)); } + /// + /// An unified unscoped and out of Project instance the property value by its name. + /// Remarks: Any property values cannot be null. + /// + /// Property name. + /// Found non-null property value or null if not. + public string GetMutualPropValue(string name) + { + return getSolutionProperty(name); + } + /// /// Getting an unified property for all existing projects. /// Aka "Solution property". diff --git a/vsSolutionBuildEvent/Log.cs b/vsSolutionBuildEvent/Log.cs index cc59b643..4e3c9216 100644 --- a/vsSolutionBuildEvent/Log.cs +++ b/vsSolutionBuildEvent/Log.cs @@ -251,11 +251,11 @@ public static void nprint(string level, string message, string stamp) { LogLevel oLevel = LogLevel.FromString(level); -#if !DEBUG +//#if !DEBUG if(oLevel < LogLevel.Info && !Settings._.DebugMode) { return; } -#endif +//#endif var log = _lazy.Value; log.write(log.format(level, message, stamp), level); diff --git a/vsSolutionBuildEvent/Logger/Initializer.cs b/vsSolutionBuildEvent/Logger/Initializer.cs index 44e31213..b7570e97 100644 --- a/vsSolutionBuildEvent/Logger/Initializer.cs +++ b/vsSolutionBuildEvent/Logger/Initializer.cs @@ -45,10 +45,7 @@ public class Initializer Action = FilterResult.Ignore, }; - /// - /// object synch. - /// - private Object _lock = new Object(); + private readonly object sync = new object(); /// /// Configure logger by default. @@ -75,7 +72,7 @@ public void configure(MethodCallTarget target) { this.target = target; - lock(_lock) + lock(sync) { LogManager.ConfigurationChanged -= onCfgLoggerChanged; LogManager.ConfigurationChanged += onCfgLoggerChanged; @@ -84,6 +81,9 @@ public void configure(MethodCallTarget target) LSender.SReceived -= onSReceived; LSender.SReceived += onSReceived; + + Components.LSender.Sent -= onLSenderSent; + Components.LSender.Sent += onLSenderSent; } Log.Trace($"Log('{target.ClassName}') is configured for: '{GuidList.PACKAGE_LOGGER}'"); @@ -169,5 +169,17 @@ private void onSReceived(object sender, Message e) $"{nameof(MvsSln)}: {e.content}" ); } + + private void onLSenderSent(object sender, Components.Message e) + { + Log._.NLog.Log + ( + LogLevel.FromOrdinal + ( + (int)(e.level == Components.MsgLevel.Info ? Components.MsgLevel.Debug : e.level) + ), + $"{sender.GetType().Name}: {e.content}" + ); + } } } diff --git a/vsSolutionBuildEvent/MSBuild.cs b/vsSolutionBuildEvent/MSBuild.cs new file mode 100644 index 00000000..c19a4634 --- /dev/null +++ b/vsSolutionBuildEvent/MSBuild.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . +*/ + +using net.r_eg.EvMSBuild; +using net.r_eg.Varhead; +using net.r_eg.vsSBE.Bridge.CoreCommand; + +namespace net.r_eg.vsSBE +{ + internal static class MSBuild + { + internal static IEvMSBuild MakeEvaluator(IEnvironment env, IUVars uvars) + => PostAction(env, new EvMSBuilder(env, uvars)); + + internal static IEvMSBuild MakeEvaluator(IEnvironment env) + => PostAction(env, new EvMSBuilder(env)); + + private static IEvMSBuild PostAction(IEnvironment env, IEvMSBuild instance) + { + //TODO: to CoreCommandType + + instance.GlobalPropertyChanged += (object sender, PropertyArgs e) + => env?.CoreCmdSender?.fire(GetRawCommand(new[] + { + e.Removed ? "property.del" : "property.set", + e.name, + e.value + })); + + return instance; + } + + private static CoreCommandArgs GetRawCommand(object[] cmd) + => new CoreCommandArgs() { Type = CoreCommandType.RawCommand, Args = cmd }; + } +} diff --git a/vsSolutionBuildEvent/MSBuild/Exceptions/MSBProjectNotFoundException.cs b/vsSolutionBuildEvent/MSBuild/Exceptions/MSBProjectNotFoundException.cs deleted file mode 100644 index 12f9f35a..00000000 --- a/vsSolutionBuildEvent/MSBuild/Exceptions/MSBProjectNotFoundException.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.MSBuild.Exceptions -{ - [Serializable] - public class MSBProjectNotFoundException: SBEException - { - public MSBProjectNotFoundException(string message) - : base(message) - { - - } - - public MSBProjectNotFoundException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/MSBuild/Exceptions/MSBPropertyNotFoundException.cs b/vsSolutionBuildEvent/MSBuild/Exceptions/MSBPropertyNotFoundException.cs deleted file mode 100644 index 08d62b91..00000000 --- a/vsSolutionBuildEvent/MSBuild/Exceptions/MSBPropertyNotFoundException.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.MSBuild.Exceptions -{ - [Serializable] - public class MSBPropertyNotFoundException: SBEException - { - public MSBPropertyNotFoundException(string message) - : base(message) - { - - } - - public MSBPropertyNotFoundException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/MSBuild/Exceptions/MSBPropertyParseException.cs b/vsSolutionBuildEvent/MSBuild/Exceptions/MSBPropertyParseException.cs deleted file mode 100644 index d8c1d22f..00000000 --- a/vsSolutionBuildEvent/MSBuild/Exceptions/MSBPropertyParseException.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.MSBuild.Exceptions -{ - [Serializable] - public class MSBPropertyParseException: SBEException - { - public MSBPropertyParseException(string message) - : base(message) - { - - } - - public MSBPropertyParseException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/MSBuild/Exceptions/PossibleLoopException.cs b/vsSolutionBuildEvent/MSBuild/Exceptions/PossibleLoopException.cs deleted file mode 100644 index 33537f97..00000000 --- a/vsSolutionBuildEvent/MSBuild/Exceptions/PossibleLoopException.cs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.MSBuild.Exceptions -{ - [Serializable] - public class PossibleLoopException: SBEException - { - public PossibleLoopException() - { - - } - - public PossibleLoopException(string message) - : base(message) - { - - } - - public PossibleLoopException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/MSBuild/IMSBuild.cs b/vsSolutionBuildEvent/MSBuild/IMSBuild.cs deleted file mode 100644 index 6444a386..00000000 --- a/vsSolutionBuildEvent/MSBuild/IMSBuild.cs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System.Collections.Generic; -using System.Runtime.InteropServices; -using Microsoft.Build.Evaluation; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.MSBuild -{ - [Guid("958B9A32-BE6F-4B74-A98A-AC99099A63A5")] - public interface IMSBuild - { - /// - /// Used environment. - /// - IEnvironment Env { get; } - - /// - /// Container of user-variables. - /// - IUserVariable UVariable { get; } - - /// - /// MSBuild Property from default Project - /// - /// key property - /// evaluated value - string getProperty(string name); - - /// - /// MSBuild Property from specific project - /// - /// key property - /// project name - /// evaluated value - string getProperty(string name, string projectName); - - /// - /// Gets all properties from specific project. - /// - /// - /// - List listProperties(string projectName = null); - - /// - /// Evaluate data with MSBuild engine. - /// Property Functions Syntax: - /// http://msdn.microsoft.com/en-us/library/vstudio/dd633440%28v=vs.120%29.aspx - /// - /// raw unevaluated data - /// specific project or null value for default - /// Evaluated value - string evaluate(string unevaluated, string projectName = null); - - /// - /// Entry point to evaluating MSBuild data. - /// - /// mixed data - /// All evaluated values for data - string parse(string data); - - /// - /// Getting project instance by name. - /// - /// Project name. - /// Returns new instance if fail. - Project getProject(string name); - - /// - /// To initialize properties by default for project. - /// - /// Uses GlobalProjectCollection if null. - void initPropByDefault(Project project = null); - } -} diff --git a/vsSolutionBuildEvent/MSBuild/Parser.cs b/vsSolutionBuildEvent/MSBuild/Parser.cs deleted file mode 100644 index de4b999a..00000000 --- a/vsSolutionBuildEvent/MSBuild/Parser.cs +++ /dev/null @@ -1,841 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Threading; -using Microsoft.Build.Evaluation; -using net.r_eg.MvsSln; -using net.r_eg.vsSBE.Bridge.CoreCommand; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.MSBuild.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.MSBuild -{ - public class Parser: IMSBuild, IEvaluator - { - public const string PROP_VALUE_DEFAULT = PropertyNames.UNDEFINED; - - /// - /// Max of supported containers for processing. - /// - protected const uint CONTAINERS_LIMIT = 1 << 16; - - /// - /// Provides operation with environment - /// - protected IEnvironment env; - - /// - /// Used instance of user-variables - /// - protected IUserVariable uvariable; - - /// - /// References of evaluated properties. - /// - private Dictionary> references = new Dictionary>(); - - /// - /// object synch. - /// - private readonly object _lock = new object(); - - /// - /// Used environment. - /// - public IEnvironment Env - { - get { return env; } - } - - /// - /// Container of user-variables. - /// - public IUserVariable UVariable - { - get { return uvariable; } - } - - /// - /// MSBuild Property from default Project - /// - /// key property - /// evaluated value - public string getProperty(string name) - { - return getProperty(name, null); - } - - /// - /// MSBuild Property from specific project - /// - /// key of property - /// Specific project - /// - /// Evaluated value of property - public virtual string getProperty(string name, string projectName) - { - if(uvariable.isExist(name, projectName)) { - Log.Debug("Evaluate: use '{0}:{1}' from user-variable", name, projectName); - return getUVariableValue(name, projectName); - } - - if(projectName == null) - { - string slnProp = env.getSolutionProperty(name); - if(slnProp != null) { - Log.Debug("Solution-context for getProperty - '{0}' = '{1}'", name, slnProp); - return slnProp; - } - } - - Project project = getProject(projectName); - ProjectProperty prop = project.GetProperty(name); - - if(prop != null) { - return prop.EvaluatedValue; - } - Log.Debug("getProperty: return default value"); - return PropertyNames.UNDEFINED; - } - - /// - /// Gets all properties from specific project. - /// - /// - /// - public List listProperties(string projectName = null) - { - List properties = new List(); - - Project project = getProject(projectName); - foreach(ProjectProperty property in project.Properties) - { - string eValue = property.EvaluatedValue; - if(projectName == null) - { - string slnProp = env.getSolutionProperty(property.Name); - if(slnProp != null) { - Log.Debug("Solution-context for listProperties - '{0}' = '{1}'", property.Name, slnProp); - eValue = slnProp; - } - } - - properties.Add(new PropertyItem(property.Name, eValue)); - } - return properties; - } - - /// - /// Evaluate data with MSBuild engine. - /// alternative to Microsoft.Build.BuildEngine - http://msdn.microsoft.com/en-us/library/Microsoft.Build.BuildEngine - /// - /// raw string as $(..data..) - /// specific project or null value for default - /// Evaluated value - public virtual string evaluate(string unevaluated, string projectName = null) - { - const string container = Settings.APP_NAME_SHORT + "_latestEvaluated"; - Project project = getProject(projectName); - - Log.Trace($"evaluate: '{unevaluated}' -> [{projectName}]"); - - lock(_lock) - { - CultureInfo origincul = Thread.CurrentThread.CurrentCulture; - Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; - - try - { - // To fix "Save changes to the following items" - project.DisableMarkDirty = true; - - defProperties(project); - project.SetProperty(container, Tokens.characters(_wrapProperty(ref unevaluated))); - return project.GetProperty(container).EvaluatedValue; - } - finally - { - project.RemoveProperty(project.GetProperty(container)); - project.DisableMarkDirty = false; - - Thread.CurrentThread.CurrentCulture = origincul; - - // NOTE: about other solutions for "Save changes to the following items": - - // 1) Do not use the `.Save();` on `EProject` because of possible "File Modification Detected ... has been modified outside the environment." - // 2) Do not use `.Save();` on `DProject` because of possible "Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))" - // For DProject it also activates "Save As" dialog in VS even inside try/catch - } - } - } - - /// - /// Entry point to evaluating MSBuild data. - /// - /// mixed data - /// All evaluated values for data - public virtual string parse(string data) - { - if(String.IsNullOrEmpty(data)) { - return String.Empty; // convert to not null value - } - - if(String.IsNullOrWhiteSpace(data)) { - return data; // save all white-space characters - } - - StringHandler sh = new StringHandler(); - lock(_lock) - { - return hquotes( - sh.recovery( - containerIn( - sh.protectEscContainer( - sh.protectMixedQuotes(data) - ), - sh, - CONTAINERS_LIMIT - ) - ) - ); - } - } - - /// - /// Evaluate data with MSBuild. - /// - /// mixed data - /// Evaluated value - public string evaluate(string data) - { - return parse(data); - } - - /// - /// Getting project instance by name. - /// - /// Project name. - /// Returns new instance if fail. - public Project getProject(string name) - { - try { - Log.Trace("MSBuild - getProject: Trying of getting project instance - '{0}'", name); - return env.getProject(name); - } - catch(NotFoundException) { - Log.Trace("MSBuild - getProject: use empty project by default."); - return new Project(); - } - } - - /// - /// To initialize properties by default for project. - /// - /// Uses GlobalProjectCollection if null. - public virtual void initPropByDefault(Project project = null) - { - IAppSettings app = Settings._; - const string _PFX = Settings.APP_NAME_SHORT; - - setGlobalProperty(project, Settings.APP_NAME, Version.numberWithRevString); - setGlobalProperty(project, $"{_PFX}_CommonPath", app.CommonPath); - setGlobalProperty(project, $"{_PFX}_LibPath", app.LibPath); - setGlobalProperty(project, $"{_PFX}_WorkPath", app.WorkPath); - } - - /// Used environment - /// Used user-variables - public Parser(IEnvironment env, IUserVariable uvariable) - { - this.env = env; - this.uvariable = uvariable; - } - - /// - /// The instance with default value for UserVariable - /// - /// Used environment - public Parser(IEnvironment env) - : this(env, new UserVariable()) - { - - } - - /// - /// Handler of general containers. - /// Moving upward from deepest container. - /// - /// $(name) or $(name:project) or $([MSBuild]::MakeRelative($(path1), ...):project) .. - /// https://msdn.microsoft.com/en-us/library/vstudio/dd633440%28v=vs.120%29.aspx - /// - /// - /// - /// Limitation to containers. Aborts if reached - /// - /// - protected string containerIn(string data, StringHandler sh, uint limit) - { - Regex con = RPattern.ContainerInCompiled; - int maxRep = 1; // rule of depth, e.g.: $(p1 = $(Platform))$(p2 = $(p1))$(p2) - //TODO: it's slowest but fully compatible with classic rules with minimal programming.. so, improve performance - - references.Clear(); - uint step = 0; - do - { - if(step++ > limit) { - sh.flush(); - throw new LimitException("Restriction of supported containers '{0}' reached. Aborted.", limit); - } - - data = con.Replace(data, - delegate(Match m) - { - string raw = m.Groups[1].Value; - Log.Trace("containerIn: raw - `{0}`", raw); - return evaluate(prepare(sh.recovery(raw))); - }, - maxRep); - - // protect before new checking - data = sh.protectEscContainer(sh.protectMixedQuotes(data)); - - } while(con.IsMatch(data)); - - return data; - } - - /// - /// Prepare data for next evaluation step. - /// - /// a single container e.g.: '(..data..)' - /// - protected PreparedData prepare(string raw) - { - Match m = RPattern.PItem.Match(raw.Trim()); - if(!m.Success) { - throw new IncorrectSyntaxException("prepare: failed - '{0}'", raw); - } - - Group rTSign = m.Groups["tsign"]; - Group rVSign = m.Groups["vsign"]; - Group rVariable = m.Groups[1]; - Group rStringDataD = m.Groups[2]; - Group rStringDataS = m.Groups[3]; - Group rDataWithProject = m.Groups[4]; - Group rProject = m.Groups[5]; - Group rData = m.Groups[6]; - - PreparedData ret = new PreparedData() - { - property = new PreparedData.Property() { - raw = raw - } - }; - //Log.Trace("prepare: raw '{0}'", raw); - - - /* Variable */ - - if(rVariable.Success) - { - ret.variable.name = rVariable.Value; - - switch(rTSign.Value) { - case "+": { - ret.variable.tSign = PreparedData.TSignType.DefProperty; - break; - } - case "-": { - ret.variable.tSign = PreparedData.TSignType.UndefProperty; - break; - } - default: { - ret.variable.tSign = PreparedData.TSignType.Default; - break; - } - } - - switch(rVSign.Value) { - case "+": { - ret.variable.vSign = PreparedData.VSignType.Increment; - break; - } - case "-": { - ret.variable.vSign = PreparedData.VSignType.Decrement; - break; - } - default: { - ret.variable.vSign = PreparedData.VSignType.Default; - break; - } - } - - // all $() in right operand cannot be evaluated because it's escaped and already unwrapped property. - // i.e. this already should be evaluated with prev. steps - because we are moving upward from deepest container ! - Log.Trace($"prepare: variable name = '{ret.variable.name}'; tSign({ret.variable.tSign}), vSign({ret.variable.vSign})"); - } - - - /* Data */ - - if((rStringDataD.Success || rStringDataS.Success) - && (rData.Success && !String.IsNullOrWhiteSpace(rData.Value))) - { - throw new IncorrectSyntaxException("Incorrect composition of data: string with raw data."); - } - - if(rStringDataD.Success) { - ret.property.unevaluated = parse(Tokens.unescapeQuotes('"', rStringDataD.Value)); - ret.variable.type = PreparedData.ValueType.StringFromDouble; - } - else if(rStringDataS.Success) { - ret.property.unevaluated = Tokens.unescapeQuotes('\'', rStringDataS.Value); - ret.variable.type = PreparedData.ValueType.StringFromSingle; - } - else { - ret.property.unevaluated = hquotes((rDataWithProject.Success ? rDataWithProject : rData).Value.Trim()); - ret.variable.type = (rVariable.Success)? PreparedData.ValueType.Unknown : PreparedData.ValueType.Property; - - int lp = ret.property.unevaluated.IndexOf('.'); - ret.property.name = ((lp == -1)? ret.property.unevaluated : ret.property.unevaluated.Substring(0, lp)).Trim(); - - //TODO: - if(ret.property.name.IndexOf('[') != -1) { - ret.property.name = null; // avoid static methods - } - } - - ret.property.complex = !isPropertySimple(ref ret.property.unevaluated); - - Log.Trace($"prepare: value = '{ret.property.unevaluated}'({ret.variable.type}); complex: {ret.property.complex}"); - - /* Project */ - - if(rDataWithProject.Success) - { - string project = rProject.Value.Trim(); - - if(rVariable.Success) { - //TODO: non standard! but it also can be as a $(varname = $($(..data..):project)) - ret.variable.project = project; - } - else { - ret.property.project = project; - } - } - - Log.Trace("prepare: project [v:'{0}'; p:'{1}']", ret.variable.project, ret.property.project); - return ret; - } - - /// - /// Pre-filter for data inside quotes. - /// - /// - /// - protected string hquotes(string data) - { - /* - Firstly, the all original expressions can be evaluated by original engine inside double quotes. - For all other (inc. incorrect data) we should evaluate it manually if used protection of course - ~ $([System.DateTime]::Parse("$(p:project)").ToBinary()); $([System.DateTime]::Parse("$([System.DateTime]::UtcNow.Ticks)").ToBinary()) etc. - - Generally it's important only for ~ $(p:project) expressions with protection... so TODO - */ - - Func h = delegate (string _data, char qtype) - { - return Regex.Replace(_data, - (qtype == '"')? RPattern.DoubleQuotesContent : RPattern.SingleQuotesContent, - delegate(Match m) - { - string content = m.Groups[1].Value; - return String.Format("{0}{1}{0}", qtype, parse(content)); - }, - RegexOptions.IgnorePatternWhitespace); - }; - - /* - TODO: - From single quotes is still protected for compatibility with original logic. - Because it can be different for ~ - - $([MSBuild]::Multiply('$([System.Math]::Log(2))', 16)) -> 1,10903548889591E+16 - \ \_(1) 0,693147180559945_/ - \_______________(2)__________________________________/ - - - $([MSBuild]::Multiply('$([System.Math]::Log(2))', 16)) -> 11,0903548889591 - \______________________(1)___________________________/ - - $([System.Math]::Exp(1.10903548889591E+16)) = ∞ - $([System.Math]::Exp(11.0903548889591)) = 65535,9999999983 - */ - - //return h(h(data, '\''), '"'); - return h(data, '"'); - } - - /// - /// Exceptions to the general rules - /// for example: $(registry:Hive\MyKey\MySubKey@Value) - /// - /// left operand - /// right operand - /// formatted raw to evaluation - protected virtual string customRule(string left, string right) - { - if(left == "registry" && !String.IsNullOrEmpty(right)) { // Registry Properties :: https://msdn.microsoft.com/en-us/library/vstudio/ms171458.aspx - Log.Trace("Rule: Registry Property"); - return String.Format("{0}:{1}", left, right); - } - return null; - } - - /// - /// The final value from prepared information - /// - /// - protected string evaluate(PreparedData prepared) - { - string evaluated = String.Empty; - - string custom = customRule(prepared.property.unevaluated, prepared.property.project); - if(custom != null) - { - Log.Trace("Evaluate: custom '{0}'", custom); - evaluated = evaluate(custom, null); - } - else if(prepared.variable.type == PreparedData.ValueType.StringFromDouble - || prepared.variable.type == PreparedData.ValueType.StringFromSingle - || !String.IsNullOrEmpty(prepared.variable.name)) - { - //Note: * content from double quotes should be already evaluated in prev. steps. - // * content from single quotes shouldn't be evaluated by rules with protector above. - Log.Trace("Evaluate: use content from string or use escaped property"); - evaluated = prepared.property.unevaluated; - } - else if(!prepared.property.complex) - { - Log.Trace("Evaluate: use getProperty"); - evaluated = getProperty(prepared.property.unevaluated, prepared.property.project); - try { - evaluated = unlooping(evaluated, prepared, false); - } - catch(PossibleLoopException) { - // last chance with direct evaluation - evaluated = evaluate(prepared.property.unevaluated, prepared.property.project); - evaluated = unlooping(evaluated, prepared, true); - } - } - else - { - Log.Trace("Evaluate: use evaluation with msbuild engine"); - evaluated = evaluate(prepared.property.unevaluated, prepared.property.project); - evaluated = unlooping(evaluated, prepared, true); - } - Log.Debug("Evaluated: '{0}'", evaluated); - - // updating of variables - - if(!String.IsNullOrEmpty(prepared.variable.name)) { - evaluated = defineVariable(prepared, evaluated); - } - - return evaluated; - } - - protected string defineVariable(PreparedData prepared, string evaluated) - { - evaluated = vSignOperation(prepared, evaluated); - - Log.Debug("Evaluate: ready to define variable - '{0}':'{1}'", - prepared.variable.name, - prepared.variable.project); - - uvariable.set(prepared.variable.name, prepared.variable.project, evaluated); - uvariable.evaluate(prepared.variable.name, prepared.variable.project, new EvaluatorBlank(), true); - - tSignOperation(prepared, ref evaluated); - return String.Empty; - } - - protected string vSignOperation(PreparedData prepared, string val) - { - if(prepared.variable.vSign == PreparedData.VSignType.Default) { - return val; - } - - var left = uvariable.get(prepared.variable.name, prepared.variable.project)?? "0"; - bool isNumber = RPattern.IsNumber.IsMatch(left); - - Log.Trace($"vSignOperation: '{prepared.variable.vSign}'; `{left}` (isNumber: {isNumber})"); - - if(prepared.variable.vSign == PreparedData.VSignType.Increment) - { - if(!isNumber) { - // equiv.: $(var = $([System.String]::Concat($(var), "str")) ) - return left + val; - } - - // $(var = $([MSBuild]::Add($(var), 1)) ) - // TODO: additional check for errors from right string $(i += 'test') ... this correct: $(i += $(i)) - return evaluate($"$([MSBuild]::Add('{left}', '{val}'))", prepared.variable.project); - } - - if(prepared.variable.vSign == PreparedData.VSignType.Decrement) - { - if(!isNumber) { - throw new InvalidArgumentException($"Argument `{val}` is not valid for operation '-=' or it is not supported yet."); - } - - // $(var = $([MSBuild]::Subtract($(var), 1)) ) - return evaluate($"$([MSBuild]::Subtract('{left}', '{val}'))", prepared.variable.project); - } - - return val; - } - - protected void tSignOperation(PreparedData prepared, ref string evaluated) - { -#if DEBUG - Log.Trace($"tSignOperation: '{prepared.variable.tSign}'"); -#endif - - if(prepared.variable.tSign == PreparedData.TSignType.DefProperty) { - defProperty(prepared.variable, evaluated); - } - else if(prepared.variable.tSign == PreparedData.TSignType.UndefProperty) { - undefProperty(prepared.variable); - } - } - - /// - /// Getting value from User-Variable by using scope of project - /// - /// Variable name - /// Project name - /// Evaluated value of variable - protected string getUVariableValue(string name, string project) - { - if(uvariable.isUnevaluated(name, project)) { - uvariable.evaluate(name, project, this, true); - } - return uvariable.get(name, project); - } - - /// - /// Getting value from User-Variable by using unique identification - /// - /// Unique identificator - /// Evaluated value of variable - protected string getUVariableValue(string ident) - { - if(uvariable.isUnevaluated(ident)) { - uvariable.evaluate(ident, this, true); - } - return uvariable.get(ident); - } - - /// - /// Define properties of project context from user-variables. - /// - /// - protected void defProperties(Project project) - { - foreach(TUserVariable uvar in uvariable.Variables) { - defProperty(uvar, project); - } - } - - protected void defProperty(TUserVariable uvar, Project project) - { - if(uvar.status != TUserVariable.StatusType.Started) { - setGlobalProperty(project, uvar.ident, getUVariableValue(uvar.ident)); - return; - } - - if(uvar.prev != null && ((TUserVariable)uvar.prev).unevaluated != null) - { - TUserVariable prev = (TUserVariable)uvar.prev; - setGlobalProperty(project, uvar.ident, (prev.evaluated == null)? prev.unevaluated : prev.evaluated); - } - } - - protected void defProperty(PreparedData.Variable variable, string evaluated) - { - Log.Debug("Set MSBuild property: `{0}`:`{1}`", variable.name, variable.project); - //defProperty(uvariable.getVariable(variable.name, variable.project), getProject(variable.project)); - setGlobalProperty(getProject(variable.project), variable.name, evaluated); - } - - protected bool undefProperty(PreparedData.Variable variable) - { - Log.Debug("Unset MSBuild property: `{0}`:`{1}`", variable.name, variable.project); - Project project = getProject(variable.project); - - //uvariable.unset(variable.name, variable.project); //leave for sbe-scripts - return removeGlobalProperty(project, variable.name); - } - - /// Uses GlobalProjectCollection if null. - /// - /// - /// Returns true if the value changes, otherwise returns false. - protected virtual bool setGlobalProperty(Project project, string name, string val) - { - try - { - if(project == null) { - ProjectCollection.GlobalProjectCollection.SetGlobalProperty(name, val); - return true; - } - - return project.SetGlobalProperty(name, val); - } - finally { - sendRawCoreCommand(new[] { "property.set", name, val }); //TODO: to CoreCommandType - } - } - - /// Uses GlobalProjectCollection if null. - /// - /// Returns true if the value of the global property was set. - protected virtual bool removeGlobalProperty(Project project, string name) - { - try - { - if(project == null) { - return ProjectCollection.GlobalProjectCollection.RemoveGlobalProperty(name); - } - - return project.RemoveGlobalProperty(name); - } - finally { - sendRawCoreCommand(new[] { "property.del", name }); //TODO: to CoreCommandType - } - } - - protected void sendRawCoreCommand(object[] cmd) - { - if(env == null || env.CoreCmdSender == null) { - return; - } - - env.CoreCmdSender.fire(new CoreCommandArgs() { - Type = CoreCommandType.RawCommand, - Args = cmd - }); - } - - /// - /// Operations for recursive properties and to avoiding some looping. - /// - /// The recursive property means that value contains same definition, even after evaluation of this, for example: - /// `$(var)` -> `value from $(var)` -> `value from value from $(var)` ... - /// - /// TODO: I need a COW... fix mooo ~@@`` - /// - /// Data with possible recursive property or some looping. - /// Describes property. - /// To escape equality if true, otherwise throw PossibleLoopException. - /// Evaluated data. - protected string unlooping(string data, PreparedData prepared, bool eqEscape) - { - string pname = prepared.property.name; - - if(pname == null || data.IndexOf("$(") == -1) { - return data; // all clear - } - - HashSet pchecked = new HashSet(); - Action unlink = null; - - unlink = delegate(string _name) - { - if(!pchecked.Add(_name)) { -#if DEBUG - Log.Debug("unlooping-unlink: has been protected with `{0}`", _name); -#endif - return; - //throw new MismatchException(""); - } - - if(!references.ContainsKey(_name)) { - return; - } - - if(references[_name].Contains(pname)) { - throw new LimitException("Found looping for used properties: `{0}` <-> `{1}`", _name, pname); - } - - foreach(string refvar in references[_name]) { - unlink(refvar); - } - }; - - data = RPattern.ContainerInNamedCompiled.Replace(data, delegate(Match m) - { - string found = m.Groups["name"].Value; - - if(pname == found) - { - if(eqEscape) { - return "$" + m.Groups[0].Value; - } - throw new PossibleLoopException(); - } - - if(!references.ContainsKey(pname)) { - references[pname] = new HashSet(); - } - references[pname].Add(found); - - // checking - unlink(found); - - return m.Groups[0].Value; - }); - - return data; - } - - protected virtual bool isPropertySimple(ref string data) - { - if(data.IndexOfAny(new char[] { '.', ':', '(', ')', '\'', '"', '[', ']' }) != -1) { - return false; - } - return true; - } - - private string _wrapProperty(ref string data) - { - if(!data.StartsWith("$(")) - { - Log.Trace("wrap: '{0}'", data); - return String.Format("$({0})", data); - } - return data; - } - } -} diff --git a/vsSolutionBuildEvent/MSBuild/PreparedData.cs b/vsSolutionBuildEvent/MSBuild/PreparedData.cs deleted file mode 100644 index 96e25e3d..00000000 --- a/vsSolutionBuildEvent/MSBuild/PreparedData.cs +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.MSBuild -{ - public struct PreparedData - { - /// - /// Available value types - /// - public enum ValueType - { - Unknown, - /// - /// MSBuild properties - /// - Property, - /// - /// Escaped MSBuild properties - /// - PropertyEscaped, - /// - /// String data ".." - /// - StringFromDouble, - /// - /// String data '..' - /// - StringFromSingle, - } - - public enum TSignType - { - Default, - - /// - /// Set the global msbuild property. - /// - DefProperty, - - /// - /// Unset the global msbuild property. - /// - UndefProperty, - } - - public enum VSignType - { - Default, - - /// - /// left += right - /// - Increment, - - /// - /// left -= right - /// - Decrement, - } - - public struct Variable - { - /// - /// Variable name - /// - public string name; - - /// - /// Project context for variable. - /// or specific project where to store. - /// - public string project; - - /// - /// Storing inside project files ~ .csproj, .vcxproj, .. - /// - public bool persistence; - - /// - /// Available types of value - /// - public ValueType type; - - /// - /// $({tSign}name = data) - /// - public TSignType tSign; - - /// - /// $(name {vSign}= data) - /// - public VSignType vSign; - } - - public struct Property - { - /// - /// Complex phrase or simple property - /// e.g.: - /// * MSBuild Property Function: $([System.DateTime]::UtcNow.Ticks) - /// * Simple MSBuild Property: $(Configuration) - /// - public bool complex; - - /// - /// Prepared but unevaluated data, i.e. the evaluation should be from this! - /// - public string unevaluated; - - /// - /// The left definition of property. - /// - public string name; - - /// - /// Specific project for property - /// - public string project; - - /// - /// Initial data - /// - public string raw; - } - - /// - /// User-variable of MSBuild core - /// - public Variable variable; - - /// - /// Unit of properties - /// - public Property property; - } -} diff --git a/vsSolutionBuildEvent/MSBuild/PropertyItem.cs b/vsSolutionBuildEvent/MSBuild/PropertyItem.cs deleted file mode 100644 index f6de9312..00000000 --- a/vsSolutionBuildEvent/MSBuild/PropertyItem.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.MSBuild -{ - /// - /// Basic unit of properties - /// - public struct PropertyItem - { - public string name; - public string value; - - public PropertyItem(string name, string value) - { - this.name = name; - this.value = value; - } - } -} diff --git a/vsSolutionBuildEvent/MSBuild/RPattern.cs b/vsSolutionBuildEvent/MSBuild/RPattern.cs deleted file mode 100644 index 36486d6d..00000000 --- a/vsSolutionBuildEvent/MSBuild/RPattern.cs +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Text.RegularExpressions; - -namespace net.r_eg.vsSBE.MSBuild -{ - public static class RPattern - { - /// - /// Compiled ContainerIn. - /// - public static readonly Regex ContainerInCompiled = new Regex(ContainerIn, - RegexOptions.IgnorePatternWhitespace | - RegexOptions.Compiled); - - /// - /// Compiled ContainerIn with naming the left definitions. - /// - public static readonly Regex ContainerInNamedCompiled = new Regex( - getContainerIn(@"\s*(?'name'[^$\s).:]+)"), // $( name ... - RegexOptions.IgnorePatternWhitespace | - RegexOptions.Compiled); - - /// - /// Checks the numeric format. - /// - public static readonly Regex IsNumber = new Regex(@"^\d+([.,]\d+)?$", RegexOptions.Compiled); - - /// - /// State of the container - /// - public enum ContainerType - { - /// - /// $(..) - /// - Normal, - /// - /// $$(..) - /// - Escaped, - /// - /// $(..) / $$(..) - /// - Unclear - } - - /// - /// Property item of MSBuild expression. - /// - public static Regex PItem - { - get - { - if(pitem == null) { - pitem = new Regex( - String.Format(@"^\( - (?: - \s* - (?'tsign'-|\+)? - ([A-Za-z_0-9]+) # 1 -> variable name (optional) - \s* - (?'vsign'-|\+)? - =\s* - (?: {0} # 2 -> string data inside double quotes - | - {1} # 3 -> string data inside single quotes - )? - )? - (?: - (.+) # 4 -> unevaluated data - (? specific project for variable if 1 is present or for unevaluated data - | # or: - (.+) # 6 -> unevaluated data - )? - \)$", - DoubleQuotesContent, - SingleQuotesContent - ), - RegexOptions.IgnorePatternWhitespace | - RegexOptions.Compiled); - } - return pitem; - } - } - private static Regex pitem; - - /// - /// Escaped outer container, e.g.: -} $$(.. $(..) ...) {- - /// - public static string ContainerEscOuter - { - get { - if(containerEscOuter == null) { - containerEscOuter = container(ContainerType.Escaped, false); - } - return containerEscOuter; - } - } - private static string containerEscOuter; - - /// - /// Deepest container, e.g.: $(.. -} $(..) {- ...) - /// - public static string ContainerIn - { - get { - if(containerIn == null) { - containerIn = container(ContainerType.Normal, true); - } - return containerIn; - } - } - private static string containerIn; - - /// - /// Outer container, e.g.: -} $(.. $(..) ...) {- - /// - public static string ContainerOuter - { - get { - if(containerOuter == null) { - containerOuter = container(ContainerType.Normal, false); - } - return containerOuter; - } - } - private static string containerOuter; - - /// - /// Double quotes with content - /// - public static string DoubleQuotesContentFull - { - get { - if(doubleQuotesContentFull == null) { - doubleQuotesContentFull = quotesContent('"', false); - } - return doubleQuotesContentFull; - } - } - private static string doubleQuotesContentFull; - - /// - /// Single quotes with content - /// - public static string SingleQuotesContentFull - { - get { - if(singleQuotesContentFull == null) { - singleQuotesContentFull = quotesContent('\'', false); - } - return singleQuotesContentFull; - } - } - private static string singleQuotesContentFull; - - /// - /// Content from double quotes - /// - public static string DoubleQuotesContent - { - get { - if(doubleQuotesContent == null) { - doubleQuotesContent = quotesContent('"', true); - } - return doubleQuotesContent; - } - } - private static string doubleQuotesContent; - - /// - /// Content from single quotes - /// - public static string SingleQuotesContent - { - get { - if(singleQuotesContent == null) { - singleQuotesContent = quotesContent('\'', true); - } - return singleQuotesContent; - } - } - private static string singleQuotesContent; - - /// - /// Deepest container, e.g.: $(.. -} $(..) {- ...) - /// - /// Condition of left bracket - `$(left` - public static string getContainerIn(string left) - { - return container(ContainerType.Normal, true, left); - } - - /// - /// Content for present symbol of quotes - /// Escaping is a \ for used symbol - /// e.g.: \', \" - /// However! '\' and "\" used 'as is' for compatibility with MSBuild - /// - /// ' or " - /// - private static string quotesContent(char symbol, bool withoutQuotes = true) - { - return String.Format(@" - (? - /// Container variants - /// - /// - /// all or only internal(deepest) - /// Condition of left bracket - `$(left` - /// - private static string container(ContainerType type, bool upward, string left = "") - { - /* PCRE: - ( - \${1,2} - ) - (?= - ( - \( - (?> - [^()] - | - (?2) - )* - \) - ) - ) ~-> for .NET: v - */ - return String.Format(@"({0}{1} - \${{{2}}} - ) - ( - \({3} - (?> - {4}[^()] - | - \((?) - | - \)(?<-R>) - )* - (?(R)(?!)) - \) - )", - (type == ContainerType.Unclear)? String.Empty : "?:", - (type == ContainerType.Normal)? @"(? GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Text.RegularExpressions; - -namespace net.r_eg.vsSBE.MSBuild -{ - public class StringHandler: Scripts.StringProtector - { - /// - /// Specific format of double quotes with content - /// - public override string DoubleQuotesContentFull - { - get { return RPattern.DoubleQuotesContentFull; } - } - - /// - /// Specific format of single quotes with content - /// - public override string SingleQuotesContentFull - { - get { return RPattern.SingleQuotesContentFull; } - } - - /// - /// Protects escaped MSBuild data. - /// - /// - /// protected string - public string protectEscContainer(string data) - { - lock(_lock) - { - return Regex.Replace(data, RPattern.ContainerEscOuter, delegate(Match m) - { - uint ident = IdentNext; - strings[ident] = "$" + m.Groups[1].Value; - Log.Trace("StringHandler: protect the escaped outer container '{0}' :: '{1}'", strings[ident], ident); - return replacementIn(ident); - }, - RegexOptions.IgnorePatternWhitespace); - } - } - } -} diff --git a/vsSolutionBuildEvent/MainToolCommand.cs b/vsSolutionBuildEvent/MainToolCommand.cs index 4356fe87..b0f8ab67 100644 --- a/vsSolutionBuildEvent/MainToolCommand.cs +++ b/vsSolutionBuildEvent/MainToolCommand.cs @@ -122,7 +122,7 @@ private void onAction(object sender, EventArgs e) if(UI.Util.focusForm(configFrm)) { return; } - configFrm = new UI.WForms.EventsFrm(apievt.Bootloader); + configFrm = new UI.WForms.EventsFrm(Bootloader._); configFrm.Show(); } catch(Exception ex) { diff --git a/vsSolutionBuildEvent/OwpEnv.cs b/vsSolutionBuildEvent/OwpEnv.cs new file mode 100644 index 00000000..9f47bca7 --- /dev/null +++ b/vsSolutionBuildEvent/OwpEnv.cs @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . +*/ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using EnvDTE; +using net.r_eg.SobaScript.Z.VS.Owp; +using net.r_eg.vsSBE.Receiver.Output; +using OWPIdent = net.r_eg.vsSBE.Receiver.Output.Ident; +using OWPItems = net.r_eg.vsSBE.Receiver.Output.Items; + +namespace net.r_eg.vsSBE +{ + internal sealed class OwpEnv: IOwpEnv + { + private IEnvironment env; + + public string DefaultItem => Settings._.DefaultOWPItem; + + public IEWData EWData + { + get; + private set; + } + + private IOW Owp + { + get + { + if(env.OutputWindowPane == null) { + throw new NotSupportedException("Owp is not available for current environment."); + } + return env.OutputWindowPane; + } + } + + public bool Write(string content, bool newline, string name, bool createIfNo = false) + { + var pane = GetPane(name, createIfNo); + if(pane == null) { + return false; + } + + if(newline) { + content += System.Environment.NewLine; + } + + pane.OutputString(content); + return true; + } + + public bool Activate(string name) + { + var pane = GetPane(name); + if(pane == null) { + return false; + } + + pane.Activate(); + return true; + } + + public bool Delete(string name) + { + if(GetPane(name) == null) { + return false; + } + + Owp.deleteByName(name); + return true; + } + + public bool Clear(string name) + { + var pane = GetPane(name); + if(pane == null) { + return false; + } + + pane.Clear(); + return true; + } + + public IEWData GetEWData(string item, bool isGuid) + { + IItemEW ew = OWPItems._.getEW + ( + isGuid ? new OWPIdent() { guid = item } + : new OWPIdent() { item = item } + ); + + return new _EWData(ew.Raw, ew.Errors, ew.Warnings); + } + + public OwpEnv(IEnvironment env) + { + this.env = env ?? throw new ArgumentNullException(nameof(env)); + } + + private OutputWindowPane GetPane(string name, bool createIfNo = false) + { + if(name == null) { + return null; + } + + if(createIfNo) { + return Owp.getByName(name, true); + } + + try { + return Owp.getByName(name, false); + } + catch(ArgumentException ex) + { + Log.Debug + ( + $"'{name}' pane is not available. Use 'force' flag for automatic creation if needed. /{ex.Message}" + ); + } + + return null; + } + + private sealed class _EWData: IEWData + { + public string Raw { get; private set; } + + public ReadOnlyCollection Errors { get; private set; } + + public ReadOnlyCollection Warnings { get; private set; } + + public _EWData(string raw, List errors, List warns) + { + Raw = raw; + Errors = errors.AsReadOnly(); + Warnings = warns.AsReadOnly(); + } + } + } +} diff --git a/vsSolutionBuildEvent/Pkg.cs b/vsSolutionBuildEvent/Pkg.cs index 60768d0c..e4f3c8a8 100644 --- a/vsSolutionBuildEvent/Pkg.cs +++ b/vsSolutionBuildEvent/Pkg.cs @@ -348,7 +348,7 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke { Trace.WriteLine($"Entering InitializeAsync() of: { ToString() }"); - await base.InitializeAsync(cancellationToken, progress); + //await base.InitializeAsync(cancellationToken, progress); // When initialized asynchronously, the current thread may be a background thread at this point. // Do any initialization that requires the UI thread after switching to the UI thread. @@ -458,7 +458,15 @@ private void initAppEvents(CancellationToken cancellationToken) usrCfg.load(usrCfg.getLink(Settings._.CommonPath, Config.Entity.NAME, null)); Event = new API.EventLevel(); - ((IEntryPointCore)Event).load(Dte2, usrCfg.Data.Global.DebugMode); + ((IEntryPointCore)Event).load + ( + Dte2, +#if DEBUG + true +#else + usrCfg.Data.Global.DebugMode +#endif + ); // Receiver diff --git a/vsSolutionBuildEvent/Properties/AssemblyInfo.cs b/vsSolutionBuildEvent/Properties/AssemblyInfo.cs index 76e5789b..db46770d 100644 --- a/vsSolutionBuildEvent/Properties/AssemblyInfo.cs +++ b/vsSolutionBuildEvent/Properties/AssemblyInfo.cs @@ -1,5 +1,5 @@ using System.Reflection; -using System.Resources; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using net.r_eg.vsSBE; @@ -11,10 +11,16 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("vsSolutionBuildEvent")] -[assembly: AssemblyCopyright("Denis Kuzmin - entry.reg@gmail.com")] +[assembly: AssemblyCopyright("Denis Kuzmin - GitHub/3F")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguage("en-US")] + +// friendly assemblies +[assembly: InternalsVisibleTo("vsSolutionBuildEventTest, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c54bb53319f73c" + + "b0368378ff4e5f2bfc3a4747c58e858493f0df593aefe0ea51ee6e1da2c50a1594b6bb0378ff85" + + "8a87a82ed2487b206a718f17c24c2533b6657aaa5f52d42bcfd02333e0db3e35165a9f09fac099" + + "9f4e781777e9be0a7cd6bfe67de2a4c5d2d4b094faa0f2879b25d678e0a1cd1fc36fa448a8f4c6" + + "65e875d6")] // 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 diff --git a/vsSolutionBuildEvent/Receiver/Output/Items.cs b/vsSolutionBuildEvent/Receiver/Output/Items.cs index e3ae20be..d019cd85 100644 --- a/vsSolutionBuildEvent/Receiver/Output/Items.cs +++ b/vsSolutionBuildEvent/Receiver/Output/Items.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; using System.Linq; +using net.r_eg.SobaScript.Exceptions; using net.r_eg.vsSBE.Exceptions; using net.r_eg.vsSBE.Extensions; @@ -83,12 +84,12 @@ public IItem get(ItemType type, Ident ident) return new ItemEW(); } else if(item == null) { - throw new NotFoundException("OWP Items-EW: The '{0}:{1}' is not found.", ident.guid, ident.item); + throw new NotFoundException(ident.item, $"OWP Items-EW: The '{ident.guid}:{ident.item}' is not found.", ident.guid); } return item; } } - throw new NotFoundException("OWP Items: Type '{0}' is not supported.", type); + throw new NotFoundException(type, $"OWP Items: Type '{type}' is not supported."); } private Items() { } diff --git a/vsSolutionBuildEvent/SBEScripts/Bootloader.cs b/vsSolutionBuildEvent/SBEScripts/Bootloader.cs deleted file mode 100644 index bcfcf04d..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Bootloader.cs +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.SBEScripts -{ - public class Bootloader: IBootloader - { - /// - /// All enabled from the registered components - /// - public IEnumerable Components - { - get { - foreach(KeyValuePair component in components) { - if(!component.Value.Enabled) { - continue; - } - yield return component.Value; - } - } - } - - /// - /// All registered components - /// - public IEnumerable Registered - { - get { - foreach(KeyValuePair component in components) { - yield return component.Value; - } - } - } - - /// - /// Provides operations with environment - /// - public IEnvironment Env - { - get; - protected set; - } - - /// - /// Current container of user-variables - /// - public IUserVariable UVariable - { - get; - protected set; - } - - /// - /// Main storage - /// - protected ConcurrentDictionary components = new ConcurrentDictionary(); - - /// - /// Gets component for selected type - /// - /// - /// Instance of the IComponent or null value if the type not registered in collection - public IComponent getComponentByType(Type type) - { - if(components.ContainsKey(type)) { - return components[type]; - } - return null; - } - - /// - /// Register new component. - /// - /// component - public void register(IComponent c) - { - if(String.IsNullOrEmpty(c.Condition)) { - throw new ComponentException("Condition for '{0}' is null or empty.", c.ToString()); - } - - Type ident = c.GetType(); - if(components.ContainsKey(ident)) { - throw new ComponentException("IComponent '{0}:{1}' is already registered.", ident, c.ToString()); - } - components[ident] = c; - } - - /// - /// Register the all default components. - /// - public virtual void register() - { - register(new TryComponent(this)); - register(new CommentComponent()); - register(new BoxComponent(this)); - register(new ConditionComponent(this)); - register(new UserVariableComponent(this)); - register(new OWPComponent(Env)); - register(new DTEComponent(Env)); - register(new InternalComponent(this)); - register(new MSBuildComponent(this)); - register(new BuildComponent(Env)); - register(new FunctionComponent(this)); - register(new FileComponent(this)); - register(new NuGetComponent(this)); - register(new SevenZipComponent(this)); - } - - /// - /// Unregister specific component. - /// - /// component - public void unregister(IComponent c) - { - IComponent v; - if(!components.TryRemove(c.GetType(), out v)) { - throw new SBEException("Cannot remove component '{0}'", c.ToString()); - } - } - - /// - /// Unregister all available components. - /// - public void unregister() - { - components.Clear(); - } - - /// - /// Activation of components with ISolutionEvents. - /// - /// - public void updateActivation(ISolutionEvents data) - { - if(data == null) { - Log.Debug("Bootloader: Changing of activation has been ignored."); - return; - } - - foreach(IComponent c in Registered) - { - if(data.Components == null || data.Components.Length < 1) { - //c.Enabled = true; - continue; - } - - Configuration.Component found = data.Components.Where(p => p.ClassName == c.GetType().Name).FirstOrDefault(); - if(found == null) { - continue; - } - -#if DEBUG - if(c.Enabled != found.Enabled) { - Log.Trace("Bootloader - Component '{0}': Changing of activation status '{1}' -> '{2}'", found.ClassName, c.Enabled, found.Enabled); - } -#endif - c.Enabled = found.Enabled; - } - } - - /// Used environment - /// Used instance of user-variable - public Bootloader(IEnvironment env, IUserVariable uvariable) - { - Env = env; - UVariable = uvariable; - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/CValueType.cs b/vsSolutionBuildEvent/SBEScripts/CValueType.cs deleted file mode 100644 index 0d792753..00000000 --- a/vsSolutionBuildEvent/SBEScripts/CValueType.cs +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.SBEScripts -{ - /// - /// Specification of possible values for components and other places of the core - /// - public enum CValueType - { - /// - /// Specifies that the: - /// * Method doesn't return a value and/or takes no parameters - /// * Property: for setting (readonly) / for getting - i.e. only as setter - /// It's also used for binding the next Property/Method. - /// - Void, - /// - /// Value of different or untyped / uncertain types - /// - Mixed, - /// - /// Any stream data input. - /// It's also used for binding the multiline data for: - /// * Property: #[Component property: multiline data] - /// * Method: #[Component method("arg"): multiline data] - /// - Input, - /// - /// Predefined data - /// - Enum, - Const, - - String, - Boolean, - Integer, - Float, - - /// - /// Unsigned types - /// - UInteger, - UFloat, - - /// - /// Sequential list of mixed values. - /// format: 1,2,3,4,5,6,7 - /// - List, - - /// - /// Object data. Similar as array with mixed data. - /// Format: { "p1", true, { 12, 'n', -4.5f }, 12d } - /// - Object, - - /// - /// Mixed expressions like Conditional Expression etc. - /// - Expression, - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/BoxComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/BoxComponent.cs deleted file mode 100644 index 451a87fe..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/BoxComponent.cs +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using System.Threading; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.MSBuild; -using net.r_eg.vsSBE.SBEScripts.Components.Condition; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - [Component("Box", "Container of data for operations like a template, repeating, etc.")] - public class BoxComponent: Component, IComponent - { - /// - /// Soft limit of iterations for user scripts. - /// - public long iterationLimit = UInt32.MaxValue; - - /// - /// Core of conditional expressions. - /// - protected Expression expression; - - /// - /// The main storage of the content of data node. - /// - protected Dictionary content = new Dictionary(); - - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "Box"; } - } - - /// - /// Should be located before deepening - /// - public override bool BeforeDeepen - { - get { return true; } - } - - protected sealed class ConditionalExpression: Expression - { - private BoxComponent cond; - - protected override string evaluate(string data) - { - return cond.evaluate(data); - } - - public ConditionalExpression(BoxComponent cond, ISBEScript script, IMSBuild msbuild) - : base(script, msbuild) - { - this.cond = cond; - } - } - - protected Regex RawExp - { - get; - private set; - } = new Regex(RPattern.RoundBracketsContent, RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled); - - /// Used environment - /// Instance of user-variables - public BoxComponent(IEnvironment env, IUserVariable uvariable) - : base(env, uvariable) - { - init(); - } - - /// Initialization with loader - public BoxComponent(IBootloader loader) - : base(loader) - { - init(); - } - - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - var point = entryPoint(data); - string subtype = point.Key; - string request = point.Value; - - Log.Trace("`{0}`: subtype - `{1}`, request - `{2}`", ToString(), subtype, request); - - if(subtype == "repeat" || subtype == "iterate") - { - string expression; - IPM epm = new PM( - extractExpression(request, out expression), - msbuild - ); - - switch(subtype) { - case "repeat": { - return stRepeat(epm, expression); - } - case "iterate": { - return stIterate(epm, expression); - } - } - } - - IPM pm = new PM(request, msbuild); - switch(subtype) { - case "operators": { - return stOperators(pm); - } - case "data": { - return stData(pm); - } - } - - throw new SubtypeNotFoundException("Subtype `{0}` is not found", subtype); - } - - /// - /// Sample: #[Box repeat(condition [; silent]): content] - /// - [Method("repeat", - "repeat($(i) < 10) { ... }\n\nExecutes a block until a specified expression evaluates to false.", - new string[] { "condition", "In" }, - new string[] { "Conditional expression.", "mixed data" }, - CValueType.Void, - CValueType.Expression, CValueType.Input)] - [Method("repeat", - "repeat($(i) < 10; true) { ... }\n\nExecutes in silent mode a block until a specified expression evaluates to false.", - new string[] { "condition; silent", "In" }, - new string[] { "\n -> condition - Conditional expression.\n -> silent - Flag of silent mode.", "mixed data" }, - CValueType.Void, - CValueType.Expression, CValueType.Input)] - protected string stRepeat(IPM pm, string expression) - { - if(!pm.It(LevelType.Method, "repeat") || !pm.IsRight(LevelType.RightOperandColon)) { - throw new IncorrectNodeException(pm); - } - - Argument[] args = (new PM()).arguments(expression, ';'); - if(args == null || args.Length > 2 || args.Length < 1) { - throw new InvalidArgumentException($"Incorrect arguments: {args?.Length} `{expression}`"); - } - - string condition = args[0].data.ToString(); - bool silent = false; - - if(args.Length == 2) { - if(args[1].type != ArgumentType.Boolean) { - throw new InvalidArgumentException($"Incorrect type of argument `silent`: {args[1].type}"); - } - silent = (bool)args[1].data; - } - - return doRepeat(condition, pm.FirstLevel.Data, null, silent); - } - - /// - /// Sample: #[Box iterate(i = 0; $(i) < 10; i = $([MSBuild]::Add($(i), 1))): content ] - /// - [Method("iterate", - "iterate(i = 0; $(i) < 10; $([MSBuild]::Add($(i), 1))) { ... }\n\nExecutes a block when condition is true.", - new string[] { "initializer; condition; iterator", "In" }, - new string[] { "\n -> initializer - Optional initial state.\n -> condition - Conditional expression.\n -> iterator - Optional operation after each iteration.", "mixed data" }, - CValueType.Void, - CValueType.Expression, CValueType.Input)] - protected string stIterate(IPM pm, string expression) - { - if(!pm.It(LevelType.Method, "iterate") || !pm.IsRight(LevelType.RightOperandColon)) { - throw new IncorrectNodeException(pm); - } - - Argument[] args = (new PM()).arguments(expression, ';'); - if(args == null || args.Length != 3) { - throw new InvalidArgumentException($"Incorrect arguments `iterate(; condition; )`: {args?.Length} `{expression}`"); - } - - string initializer = args[0].data.ToString(); - string condition = args[1].data.ToString(); - string iterator = args[2].data.ToString(); - - if(!String.IsNullOrWhiteSpace(initializer)) { - evaluate($"$({initializer})"); - } - - iterator = String.IsNullOrWhiteSpace(iterator) ? null : $"$({iterator})"; - - return doRepeat(condition, pm.FirstLevel.Data, iterator, false); - } - - protected virtual string doRepeat(string condition, string block, string iterator, bool silent) - { - Log.Debug($"doRepeat: condition `{condition}`; block `{block}`; silent: {silent}"); - string ret = String.Empty; - -#if DEBUG - long idx = 0; -#endif - while(expression.isTrue(condition)) - { - if(silent) { - evaluate(block); - } - else { - ret += evaluate(block); - } - - if(iterator != null) { - evaluate(iterator); - } - -#if DEBUG - if(++idx > iterationLimit) { - throw new LimitException($"Iteration Limit of '{iterationLimit}' reached. Aborted."); - } -#endif - } - - return ret; - } - - /// - /// #[Box operators.sleep(1000)] - /// - [Property("operators", "Access to common operators.")] - [Method("sleep", - "Suspends the current thread for a specified time.", - "operators", - "stOperators", - new string[] { "timeout" }, - new string[] { "Block current thread for a specified time in milliseconds." }, - CValueType.Void, - CValueType.Integer)] - protected string stOperators(IPM pm) - { - if(!pm.It(LevelType.Property, "operators")) { - throw new IncorrectNodeException(pm); - } - ILevel lvlOp = pm.FirstLevel; - - if(pm.FinalEmptyIs(LevelType.Method, "sleep")) - { - lvlOp.Is("sleep(integer timeout)", ArgumentType.Integer); - Thread.Sleep((int)lvlOp.Args[0].data); - - return String.Empty; - } - - throw new IncorrectNodeException(pm); - } - - [Property("data", "Main templates with data.")] - protected string stData(IPM pm) - { - if(!pm.It(LevelType.Property, "data")) { - throw new IncorrectNodeException(pm); - } - ILevel level = pm.FirstLevel; - - if(pm.FinalIs(LevelType.Method, "pack")) { - return dataPack(level, pm); - } - - if(pm.FinalEmptyIs(LevelType.Method, "free")) { - return dataFree(level, pm); - } - - if(pm.FinalEmptyIs(LevelType.Method, "get")) { - return dataGet(level, pm); - } - - if(pm.FinalEmptyIs(LevelType.Method, "clone")) { - return dataClone(level, pm); - } - - throw new IncorrectNodeException(pm); - } - - /// - /// #[Box data.pack("test", false): content] - /// - [Method("pack", - "To pack mixed data into container.", - "data", - "stData", - new string[] { "name", "eval", "In" }, - new string[] { "The name of package.", "Flag of evaluation of data before packing.", "mixed data" }, - CValueType.Void, - CValueType.String, CValueType.Boolean, CValueType.Input)] - protected string dataPack(ILevel level, IPM pm) - { - if(level.Is(ArgumentType.StringDouble, ArgumentType.Boolean)) { - return dataPack(pm.pinTo(1), (string)level.Args[0].data, (bool)level.Args[1].data); - } - - throw new ArgumentPMException(level, "data.pack(string name, boolean eval)"); - } - - protected string dataPack(IPM pm, string name, bool eval) - { - if(pm.FirstLevel.Type != LevelType.RightOperandColon) { - throw new IncorrectNodeException(pm); // #[Box data.pack(name, eval): content] - } - - if(content.ContainsKey(name)) { - throw new LimitException($"Package of data with name '{name}' is already defined before. Use `data.free` to release data and avoid this error."); - } - - Log.Trace($"`data.pack('{name}', {eval}): {pm.FirstLevel.Data}`"); - - content[name] = eval ? evaluate(pm.FirstLevel.Data) : pm.FirstLevel.Data; - Log.Trace($"packed as `{content[name]}`"); - - return String.Empty; - } - - /// - /// #[Box data.free("test")] - /// - [Method("free", - "To release existing package from container.", - "data", - "stData", - new string[] { "name" }, - new string[] { "The name of package." }, - CValueType.Void, - CValueType.String)] - protected string dataFree(ILevel level, IPM pm) - { - if(level.Is(ArgumentType.StringDouble)) { - return dataFree(pm.pinTo(1), (string)level.Args[0].data); - } - - throw new ArgumentPMException(level, "data.free(string name)"); - } - - protected string dataFree(IPM pm, string name) - { - if(content.ContainsKey(name)) { - content.Remove(name); - Log.Debug($"Package of data with name '{name}' has been removed"); - } - - return String.Empty; - } - - /// - /// #[Box data.get("test", true)] - /// - [Method("get", - "To get package data.", - "data", - "stData", - new string[] { "name", "forceEval" }, - new string[] { "The name of package.", "To force evaluate data of package before receiving." }, - CValueType.Mixed, - CValueType.String, CValueType.Boolean)] - protected string dataGet(ILevel level, IPM pm) - { - if(level.Is(ArgumentType.StringDouble, ArgumentType.Boolean)) { - return dataGet(pm.pinTo(1), (string)level.Args[0].data, (bool)level.Args[1].data); - } - - throw new ArgumentPMException(level, "data.get(string name, boolean forceEval)"); - } - - protected string dataGet(IPM pm, string name, bool forceEval) - { - if(content.ContainsKey(name)) { - return forceEval ? evaluate(content[name]) : content[name]; - } - - throw new NotFoundException($"Package of data with name '{name}' was not found."); - } - - /// - /// #[Box data.clone("test", 10)] - /// #[Box data.clone("test", 10, true)] - /// - [Method("clone", - "Multiple getting package data.", - "data", - "stData", - new string[] { "name", "count" }, - new string[] { "The name of package.", "The number of clones." }, - CValueType.Mixed, - CValueType.String, CValueType.Integer)] - [Method("clone", - "Multiple getting package data.", - "data", - "stData", - new string[] { "name", "count", "forceEval" }, - new string[] { "The name of package.", "The number of clones.", "To force evaluate data of package before receiving." }, - CValueType.Mixed, - CValueType.String, CValueType.Integer, CValueType.Boolean)] - protected string dataClone(ILevel level, IPM pm) - { - if(level.Is(ArgumentType.StringDouble, ArgumentType.Integer)) { - return dataClone(pm.pinTo(1), (string)level.Args[0].data, (int)level.Args[1].data); - } - - if(level.Is(ArgumentType.StringDouble, ArgumentType.Integer, ArgumentType.Boolean)) { - return dataClone(pm.pinTo(1), (string)level.Args[0].data, (int)level.Args[1].data, (bool)level.Args[2].data); - } - - throw new ArgumentPMException(level, "data.clone(string name, integer count [, boolean forceEval])"); - } - - protected string dataClone(IPM pm, string name, int count, bool forceEval = false) - { - if(!content.ContainsKey(name)) { - throw new NotFoundException($"Package of data with name '{name}' was not found."); - } - - if(count < 1) { - return String.Empty; - } - - string val = forceEval ? evaluate(content[name]) : content[name]; - - string ret = String.Empty; - for(int i = 0; i < count; ++i) { - ret += val; - } - return ret; - } - - /// - /// To extract conditional expression. - /// - protected virtual string extractExpression(string raw, out string expression) - { - string ret = String.Empty; - - raw = RawExp.Replace(raw, delegate(Match m) - { - ret = m.Groups[1].Value; - return "(expression)"; - }, 1); - - expression = ret; - return raw; - } - - protected void init() - { - expression = new ConditionalExpression(this, script, msbuild); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/Build/ProjectsMap.cs b/vsSolutionBuildEvent/SBEScripts/Components/Build/ProjectsMap.cs deleted file mode 100644 index e7c93e50..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/Build/ProjectsMap.cs +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) 2013-2015 Denis Kuzmin (reg) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.Bridge; - -namespace net.r_eg.vsSBE.SBEScripts.Components.Build -{ - /// - /// Detects the first / last project of build-order in solution of Visual Studio. - /// Based on https://gist.github.com/3F/a77129e3978841241927 - /// And represents final box-solution from Sample 1 - http://vssbe.r-eg.net/doc/Examples/Demo/#sample-1 - /// - public class ProjectsMap - { - /// - /// Guid of Solution Folder. - /// - public const string GUID_SLN_FOLDER = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}"; - - /// - /// Map of projects in direct order. - /// - protected List order = new List(); - - /// - /// Map of projects by Guid. - /// - protected Dictionary projects = new Dictionary(); - - /// - /// Pattern of 'Project(' line - based on crackProjectLine from Microsoft.Build.BuildEngine.Shared.SolutionParser - /// - protected Regex rProject = new Regex("^Project\\(\"(?.*)\"\\)\\s*=\\s*\"(?.*)\"\\s*,\\s*\"(?.*)\"\\s*,\\s*\"(?.*)\"$"); - - /// - /// Pattern of 'ProjectSection(ProjectDependencies)' lines - based on crackPropertyLine from Microsoft.Build.BuildEngine.Shared.SolutionParser - /// - protected Regex rProperty = new Regex("^(?[^=]*)\\s*=\\s*(?[^=]*)$"); - - /// - /// Container of project data. - /// - public struct Project - { - /// - /// The name of project. - /// - public string name; - - /// - /// Path to project. - /// - public string path; - - /// - /// Type of project. - /// - public string type; - - /// - /// Guid of project. - /// - public string guid; - } - - /// - /// Get list of project Guids. - /// In direct order of definition. - /// - public List GuidList - { - get { - return order; - } - } - - /// - /// Get first project from defined list. - /// Ignores used Build type. - /// - public Project First - { - get - { - if(order.Count < 1) { - return new Project() { name = "The First project is Undefined", path = "?" }; - } - return projects[order[0]]; - } - } - - /// - /// Get last project from defined list. - /// Ignores used Build type. - /// - public Project Last - { - get - { - if(order.Count < 1) { - return new Project() { name = "The Last project is Undefined", path = "?" }; - } - return projects[order[order.Count - 1]]; - } - } - - /// - /// Get first project in Project Build Order. - /// - /// - /// - public Project FirstBy(BuildType type) - { - switch(type) - { - case BuildType.Clean: - case BuildType.CleanCtx: - case BuildType.CleanOnlyProject: - case BuildType.CleanSelection: { - return Last; // it should be in reverse order for 'Clean' types - } - } - return First; - } - - /// - /// Get last project in Project Build Order. - /// - /// - /// - public Project LastBy(BuildType type) - { - switch(type) - { - case BuildType.Clean: - case BuildType.CleanCtx: - case BuildType.CleanOnlyProject: - case BuildType.CleanSelection: { - return First; // it should be in reverse order for 'Clean' types - } - } - return Last; - } - - /// - /// Get project by Guid string. - /// - /// Identifier of project. - /// - public Project getProjectBy(string guid) - { - return projects[guid]; - } - - /// - /// Detect projects from solution file. - /// - /// Full path to solution - /// Resets prev. data if true. - public void detect(string sln, bool flush = false) - { - if(flush) { - projects.Clear(); - order.Clear(); - } - - Dictionary> map = new Dictionary>(); - using(StreamReader reader = new StreamReader(sln, Encoding.Default)) - { - string line; - while((line = reader.ReadLine()) != null) - { - extract(reader, line.Trim(), ref map); - } - } - - // Build order - - Func h = null; - h = delegate(string id) - { - map[id].ForEach(dep => h(dep)); - if(!order.Contains(id)) { - order.Add(id); - } - return true; - }; - - foreach(KeyValuePair> project in map) - { - h(project.Key); - if(!order.Contains(project.Key)) { - order.Add(project.Key); - } - } - } - - /// Full path to solution - public ProjectsMap(string sln) - { - detect(sln); - } - - /// - /// Only to initialize analyzer. - /// - public ProjectsMap() - { - - } - - /// Used reader. - /// Current line. - /// Container of projects. - protected void extract(StreamReader reader, string line, ref Dictionary> map) - { - if(!line.StartsWith("Project(", StringComparison.Ordinal)) { - return; - } - - Match m = rProject.Match(line); - if(!m.Success) { - throw new Exception("incorrect line"); - } - - if(String.Equals(GUID_SLN_FOLDER, m.Groups["TypeGuid"].Value.Trim(), StringComparison.OrdinalIgnoreCase)) { - return; //SolutionFolder - } - - string pGuid = m.Groups["Guid"].Value.Trim(); - map[pGuid] = new List(); - - projects[pGuid] = new Project() - { - name = m.Groups["Name"].Value, - path = m.Groups["Path"].Value, - type = m.Groups["TypeGuid"].Value, - guid = pGuid - }; - - while((line = reader.ReadLine()) != null && (line != "EndProject")) - { - line = line.Trim(); - if(!line.StartsWith("ProjectSection(ProjectDependencies)", StringComparison.Ordinal)) { - continue; - } - - for(line = reader.ReadLine(); line != null; line = reader.ReadLine()) { - line = line.Trim(); - if(line.StartsWith("EndProjectSection", StringComparison.Ordinal)) { - break; - } - map[pGuid].Add(rProperty.Match(line).Groups["PName"].Value.Trim()); - } - } - } - } -} \ No newline at end of file diff --git a/vsSolutionBuildEvent/SBEScripts/Components/BuildComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/BuildComponent.cs deleted file mode 100644 index 2346a1be..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/BuildComponent.cs +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections; -using System.Diagnostics; -using EnvDTE; -using net.r_eg.vsSBE.Actions; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts.Components.Build; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - /// - /// Managing of build process at runtime. And similar operations for projects and solution. - /// - [Component("Build", "Managing of build process at runtime.")] - public class BuildComponent: Component, IComponent - { - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "Build "; } - } - - /// - /// Work with DTE-Commands - /// - protected DTEOperation DTEO - { - get { - if(dteo == null) { - Debug.Assert(env != null); - dteo = new DTEOperation(env, Events.SolutionEventType.General); - } - return dteo; - } - } - protected DTEOperation dteo; - - /// Used environment - public BuildComponent(IEnvironment env) - : base(env) - { - - } - - /// Initialize with loader - public BuildComponent(IBootloader loader) - : base(loader) - { - - } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - var point = entryPoint(data.Trim()); - string subtype = point.Key; - string request = point.Value; - - Log.Trace("`{0}`: subtype - `{1}`, request - `{2}`", ToString(), subtype, request); - - IPM pm = new PM(request, msbuild); - switch(subtype) { - case "cancel": { - return stCancel(pm); - } - case "projects": { - return stProjects(pm); - } - case "type": { - return stType(pm); - } - case "solution": { - return stSolution(pm); - } - } - - throw new SubtypeNotFoundException("Subtype `{0}` is not found", subtype); - } - - /// - /// To cancel the build task - /// `cancel = true` - /// - /// - /// found command - [Property("cancel", "To immediately cancel the build task if it's possible.", CValueType.Void, CValueType.Boolean)] - protected string stCancel(IPM pm) - { - if(!pm.It(LevelType.Property, "cancel") || !pm.IsRight(LevelType.RightOperandStd)) { - throw new IncorrectNodeException(pm); - } - - if(Value.toBoolean(pm.FirstLevel.Data)) { - Log.Debug("attempt to cancel the build"); - DTEO.exec("Build.Cancel"); - } - - return Value.Empty; - } - - /// - /// Work with configuration manager of projects through SolutionContexts. - /// - /// http://msdn.microsoft.com/en-us/library/EnvDTE.Configuration_properties.aspx - /// http://msdn.microsoft.com/en-us/library/envdte.solutioncontext.aspx - /// - /// Sample: - /// #[Build projects] - /// - /// - /// - [Property("projects", "Work with configuration manager of projects through SolutionContexts.")] - protected string stProjects(IPM pm) - { - if(!pm.It(LevelType.Property, "projects")) { - throw new IncorrectNodeException(pm); - } - - if(pm.Is(LevelType.Method, "find")) { - return stProjectsFind(pm); - } - - throw new IncorrectNodeException(pm); - } - - /// - /// .find(...) level - /// - /// - /// - [Method( - "find", - "To find project by name. It compares part of name, therefore you can use simply like a \"ZenLib\" or full name \"Zenlib\\ZenLib.vcxproj\" etc.", - "projects", - "stProjects", - new string[] { "name" }, - new string[] { "Project name" }, - CValueType.Void, - CValueType.String - )] - protected string stProjectsFind(IPM pm) - { - ILevel level = pm.FirstLevel; // level of the `find` property - - if(level.Is(ArgumentType.StringDouble)) { - string name = (string)level.Args[0].data; - return projectCfg(getContextByProject(name), pm.pinTo(1)); - } - - throw new ArgumentPMException(level, "find(string name)"); - } - - /// - /// Configuration level of project. - /// - /// - /// - /// - [Property( - "IsBuildable", - "Gets or Sets. Whether the project or item configuration of project can be built.\nAssociated with current SolutionContext.", - "find", - "stProjectsFind", - CValueType.Boolean, - CValueType.Boolean - )] - [Property( - "IsDeployable", - "Gets or Sets. Whether the current project or item configuration of project can be deployed.\nAssociated with current SolutionContext.", - "find", - "stProjectsFind", - CValueType.Boolean, - CValueType.Boolean - )] - protected string projectCfg(SolutionContext context, IPM pm) - { - Debug.Assert(context != null); - - if(pm.It(LevelType.Property, "IsBuildable")) - { - if(pm.IsRight(LevelType.RightOperandStd)) { - context.ShouldBuild = Value.toBoolean(pm.FirstLevel.Data); - return Value.Empty; - } - - if(pm.IsRight(LevelType.RightOperandEmpty)) { - return Value.from(context.ShouldBuild); - } - } - - if(pm.It(LevelType.Property, "IsDeployable")) - { - if(pm.IsRight(LevelType.RightOperandStd)) { - context.ShouldDeploy = Value.toBoolean(pm.FirstLevel.Data); - return Value.Empty; - } - - if(pm.IsRight(LevelType.RightOperandEmpty)) { - return Value.from(context.ShouldDeploy); - } - } - - throw new IncorrectNodeException(pm); - } - - /// - /// Work with type of build action - /// Sample: #[Build type] - /// - /// - /// current type - [Property("type", "Get type of current build action, or last used type if it already finished.", CValueType.Enum, CValueType.Void)] - protected string stType(IPM pm) - { - if(!pm.It(LevelType.Property, "type") || !pm.IsRight(LevelType.RightOperandEmpty)) { - throw new IncorrectNodeException(pm); - } - - return Value.from(env.BuildType); - } - - /// - /// Work with solution node. - /// Sample: #[Build solution] - /// - /// - /// - [Property("solution", "Work with solution data.")] - [Property("current", "Link to current used solution.", "solution", "stSolution"), Property("", "current", "stSolution")] - [Method("path", - "Use specific solution from selected path.", - "solution", - "stSolution", - new string[] { "sln" }, - new string[] { "Full path to solution file." }, - CValueType.Void, - CValueType.String), Property("", "path", "stSolution")] - protected string stSolution(IPM pm) - { - if(!pm.Is(LevelType.Property, "solution")) { - throw new IncorrectNodeException(pm); - } - - // solution.current. - if(pm.Is(1, LevelType.Property, "current")) - { - if(!env.IsOpenedSolution) { - throw new NotSupportedOperationException("Property 'current' is not available. Open the Solution or use 'path()' method instead."); - } - return stSlnPMap(env.SolutionFile, pm.pinTo(2)); - } - - // solution.path("file"). - if(pm.Is(1, LevelType.Method, "path")) - { - ILevel lvlPath = pm.Levels[1]; - lvlPath.Is("solution.path(string sln)", ArgumentType.StringDouble); - return stSlnPMap((string)lvlPath.Args[0].data, pm.pinTo(2)); - } - - throw new IncorrectNodeException(pm, 1); - } - - /// - /// Work with ProjectsMap of solution node. - /// - /// - /// - /// - [Property("First", "First project in Project Build Order.", "", "stSolution"), Property("", "First", "stSlnPMap")] - [Property("Last", "Last project in Project Build Order.", "", "stSolution"), Property("", "Last", "stSlnPMap")] - [Property("FirstRaw", "First project from defined list.\nIgnores used Build type.", "", "stSolution"), Property("", "FirstRaw", "stSlnPMap")] - [Property("LastRaw", "Last project from defined list.\nIgnores used Build type.", "", "stSolution"), Property("", "LastRaw", "stSlnPMap")] - [Property("GuidList", "Get list of project Guids.\nIn direct order of definition.", "", "stSolution", CValueType.List)] - [Method("projectBy", - "Get project by Guid string.", - "", - "stSolution", - new string[] { "guid" }, - new string[] { "Identifier of project." }, - CValueType.Void, - CValueType.String), Property("", "projectBy", "stSlnPMap")] - protected string stSlnPMap(string sln, IPM pm) - { - if(String.IsNullOrWhiteSpace(sln)) { - throw new InvalidArgumentException("Failed stSlnPMap: sln is empty"); - } - ProjectsMap map = getProjectsMap(sln); - - if(pm.Is(LevelType.Property, "First")) { - return projectsMap(map.FirstBy(env.BuildType), pm.pinTo(1)); - } - - if(pm.Is(LevelType.Property, "Last")) { - return projectsMap(map.LastBy(env.BuildType), pm.pinTo(1)); - } - - if(pm.Is(LevelType.Property, "FirstRaw")) { - return projectsMap(map.First, pm.pinTo(1)); - } - - if(pm.Is(LevelType.Property, "LastRaw")) { - return projectsMap(map.Last, pm.pinTo(1)); - } - - if(pm.FinalEmptyIs(LevelType.Property, "GuidList")) { - return Value.from(map.GuidList); - } - - if(pm.Is(LevelType.Method, "projectBy")) - { - ILevel lvlPrjBy = pm.FirstLevel; - lvlPrjBy.Is("projectBy(string guid)", ArgumentType.StringDouble); - return projectsMap(map.getProjectBy((string)lvlPrjBy.Args[0].data), pm.pinTo(1)); - } - - throw new IncorrectNodeException(pm); - } - - /// - /// Unpacks ProjectsMap.Project struct for user. - /// - /// - /// - /// - [Property("name", "The name of project.", "", "stSlnPMap", CValueType.String)] - [Property("path", "Path to project.", "", "stSlnPMap", CValueType.String)] - [Property("type", "Type of project.", "", "stSlnPMap", CValueType.String)] - [Property("guid", "Guid of project.", "", "stSlnPMap", CValueType.String)] - protected string projectsMap(ProjectsMap.Project project, IPM pm) - { - if(pm.FinalEmptyIs(LevelType.Property, "name")) { - return project.name; - } - - if(pm.FinalEmptyIs(LevelType.Property, "path")) { - return project.path; - } - - if(pm.FinalEmptyIs(LevelType.Property, "type")) { - return project.type; - } - - if(pm.FinalEmptyIs(LevelType.Property, "guid")) { - return project.guid; - } - - throw new IncorrectNodeException(pm); - } - - /// - /// Gets instance of ProjectsMap by solution file. - /// - /// Full path to solution file. - /// - protected virtual ProjectsMap getProjectsMap(string sln) - { - return new ProjectsMap(sln); - } - - /// Project name - /// - protected SolutionContext getContextByProject(string name) - { - if(env.SolutionActiveCfg == null) { - //TODO: - throw new ComponentException("The SolutionActiveCfg has been disabled for current environment."); - } - - IEnumerator slnc = env.SolutionActiveCfg.SolutionContexts.GetEnumerator(); - - while(slnc.MoveNext()) - { - var con = (SolutionContext)slnc.Current; - if(con.ProjectName.Contains(name)) { - return con; - } - } - - throw new NotFoundException("The project '{0}' was not found.", name); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/CommentComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/CommentComponent.cs deleted file mode 100644 index 060e0fc8..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/CommentComponent.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - /// - /// The comments for scripts. - /// - [Definition("\" \"", "The multiline comment.")] - public class CommentComponent: Component, IComponent - { - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "\""; } - } - - /// - /// Should be located before deepening - /// - public override bool BeforeDeepen - { - get { return true; } - } - - public CommentComponent() - : base() - { - - } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - Match m = Regex.Match(data, @"^\["" - .* - ""\]$", RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline); - - if(!m.Success) { - throw new SyntaxIncorrectException("Failed CommentComponent - '{0}'", data); - } - - return Value.Empty; // silent - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/Component.cs b/vsSolutionBuildEvent/SBEScripts/Components/Component.cs deleted file mode 100644 index 2a365d85..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/Component.cs +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.MSBuild; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - public abstract class Component: IComponent - { - /// - /// For evaluation with SBE-Scripts - /// - protected ISBEScript script; - - /// - /// For evaluation with MSBuild - /// - protected IMSBuild msbuild; - - /// - /// Provides operation with environment - /// - protected IEnvironment env; - - /// - /// Current container of user-variables - /// - protected IUserVariable uvariable; - - /// - /// Ability to work with data for current component - /// - public abstract string Condition { get; } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public abstract string parse(string data); - - /// - /// Allows post-processing with MSBuild core. - /// In general, some components can require immediate processing with evaluation, before passing control to next level - /// - public virtual bool PostProcessingMSBuild - { - get; - set; - } - - /// - /// Activation status - /// - public virtual bool Enabled - { - get; - set; - } = true; - - /// - /// Sets location "as is" - after deepening - /// - public virtual bool BeforeDeepen - { - get; - protected set; - } - - /// - /// To force post-analysis. - /// - public virtual bool PostParse - { - get; - protected set; - } - - /// - /// Using of the regex engine for property - Condition - /// - public virtual bool CRegex - { - get; - protected set; - } - - /// Used environment - /// Instance of user-variables - public Component(IEnvironment env, IUserVariable uvariable) - : this() - { - init(env, uvariable); - script = new Script(env, uvariable); - } - - /// Initialization with loader - public Component(IBootloader loader) - : this() - { - init(loader.Env, loader.UVariable); - script = new Script(loader); - } - - /// Instance of SBE-Scripts core - /// Instance of MSBuild core - public Component(ISBEScript script, IMSBuild msbuild) - : this(msbuild) - { - this.script = script; - } - - /// Instance of MSBuild core - public Component(IMSBuild msbuild) - : this() - { - env = msbuild.Env; - uvariable = msbuild.UVariable; - this.msbuild = msbuild; - } - - /// Used environment - public Component(IEnvironment env) - : this() - { - this.env = env; - } - - public Component() - { - Log.Trace("init: '{0}'", GetType().FullName); - } - - protected void init(IEnvironment env, IUserVariable uvariable) - { - this.env = env; - this.uvariable = uvariable; - msbuild = new MSBuild.Parser(env, uvariable); - } - - /// - /// Default entry point to start analysis. - /// - /// Raw data. - /// Additional options to engine. - /// - protected virtual KeyValuePair entryPoint(string data, RegexOptions opt = RegexOptions.None) - { - Match m = Regex.Match(data, - String.Format(@"^\[{0} - \s* - (?'request' - (?'type' - [A-Za-z_0-9]+ - ) - .* - ) - \]$", - (CRegex)? Condition : Condition.Replace(" ", @"\s") - ), - RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | opt); - - if(!m.Success) { - throw new SyntaxIncorrectException("Failed {0} - `{1}`", GetType().FullName, data); - } - - return new KeyValuePair(m.Groups["type"].Value, m.Groups["request"].Value); - } - - protected virtual string evaluate(string data) - { - Log.Trace($"'{Condition}'-evaluate: started with `{data}`"); - - if(script != null) { - data = script.parse(data); - Log.Trace($"'{Condition}'-evaluate: evaluated data: `{data}` :: ISBEScript"); - } - - if(msbuild != null) { - //if(PostProcessingMSBuild) { - data = msbuild.parse(data); - Log.Trace($"'{Condition}'-evaluate: evaluated data: `{data}` :: IMSBuild"); - //} - } - - return data; - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/Condition/Expression.cs b/vsSolutionBuildEvent/SBEScripts/Components/Condition/Expression.cs deleted file mode 100644 index 8eaa3fe5..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/Condition/Expression.cs +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.MSBuild; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.SBEScripts.Components.Condition -{ - /// - /// Core of conditional expressions. - /// - public abstract class Expression - { - /// - /// Maximum of nesting level for brackets - /// - protected const int DEPTH_BRACKETS_LIMIT = 40; - - /// - /// For evaluation with SBE-Scripts - /// - protected ISBEScript script; - - /// - /// For evaluation with MSBuild - /// - protected IMSBuild msbuild; - - /// - /// Current level of nesting brackets. - /// Aborting if reached limit - /// - private volatile uint _depthBracketsLevel = 0; - - /// - /// Protecting from incorrect symbols. - /// - private StringHandler hString = new StringHandler(); - - /// - /// object synch. - /// - private Object _lock = new Object(); - - /// mixed - protected abstract string evaluate(string data); - - /// - /// To parse of raw expression and to check the is it true. - /// - /// Raw conditional expressions. - /// - public bool isTrue(string exp) - { - lock(_lock) { - hString = new StringHandler(); - _depthBracketsLevel = 0; - } - - exp = hString.protectCores( - hString.protectMixedQuotes(exp) - ); - - Log.Trace("Expression-parse: started with - '{0}' :: '{1}' :: '{2}'", exp); - return (disclosure(exp) == Value.VTRUE); - } - - public Expression(ISBEScript script, IMSBuild msbuild) - { - this.script = script; - this.msbuild = msbuild; - } - - protected bool calculate(string data) - { - Log.Trace("Condition->calculate: started with - '{0}'", data); - data = hString.recovery(data); - Log.Trace("Condition->calculate: after recovery - '{0}'", data); - - Match m = Regex.Match(data.Trim(), - @"^\s* - (!)? #1 - flag of inversion (optional) - ([^\^=!~<>]+) #2 - left operand - boolean type if as a single - (?: - ( - === - | - !== - | - ~= - | - == - | - != - | - \^= - | - =\^ - | - >= - | - <= - | - > - | - < - ) #3 - operator (optional with #4) - (.+) #4 - right operand (optional with #3) - )?$", - RegexOptions.IgnorePatternWhitespace); - - if(!m.Success) { - throw new SyntaxIncorrectException("Failed ConditionComponent->calculate - '{0}'", data); - } - - bool invert = m.Groups[1].Success; - string left = spaces(m.Groups[2].Value); - string coperator = null; - string right = null; - bool result = false; - - if(m.Groups[3].Success) - { - coperator = m.Groups[3].Value; - right = m.Groups[4].Value; - - switch(coperator + right) { - case "===": - case "!==": - case ">=": - case "<=": { - throw new SyntaxIncorrectException("Failed ConditionComponent: reserved combination- '{0}'", data); - } - } - right = spaces(right); - } - Log.Debug("Condition->calculate: left: '{0}', right: '{1}', operator: '{2}', invert: {3}", left, right, coperator, invert); - - left = evaluate(left); - - if(right != null) { - result = Value.cmp(left, evaluate(right), coperator); - } - else { - result = Value.cmp(alias4SingleOperand(left)); - } - Log.Debug("Condition->calculate: result is: '{0}'", result); - return ((invert)? !result : result); - } - - protected virtual string alias4SingleOperand(string op) - { - if(op == "0") { - return Value.VFALSE; - } - - if(op == "1") { - return Value.VTRUE; - } - - if(String.IsNullOrWhiteSpace(op) || op == MSBuild.Parser.PROP_VALUE_DEFAULT) { - return Value.VFALSE; - } - - return op; - } - - /// - /// Handling spaces - /// - /// - /// - protected string spaces(string data) - { - Match m = Regex.Match(data.Trim(), // // ->" data "<- or ->data<- - String.Format(@"(?: - {0} #1 - with space protection - | - (.*) #2 - without - )?", - RPattern.DoubleQuotesContent - ), RegexOptions.IgnorePatternWhitespace); - - if(!m.Success) { - throw new SyntaxIncorrectException("Failed ConditionComponent->spaces - '{0}'", data); - } - - if(m.Groups[1].Success) { - return StringHandler.normalize(m.Groups[1].Value); - } - return m.Groups[2].Value.Trim(); - } - - /// - /// TODO: this realy fastest variant of implementation. - /// However, for productivity and Short-circuit Evaluation! needed additional implementation as left serial movement.. - /// - /// - /// - protected string disclosure(string data) - { - if(_depthBracketsLevel >= DEPTH_BRACKETS_LIMIT) { - _depthBracketsLevel = 0; - throw new LimitException("Condition-disclosure: Nesting level of '{0}' reached. Aborted.", DEPTH_BRACKETS_LIMIT); - } - - string ret = Regex.Replace(data, @" - \( - ( - [^()]* - ) #1 - expression - \) - ", - delegate(Match m) - { - string exp = m.Groups[1].Value.Trim(); - Log.Trace("Condition-disclosure: expression - '{0}' /level: {1}", exp, _depthBracketsLevel); - - if(String.IsNullOrEmpty(exp)) { - throw new SyntaxIncorrectException("Condition-disclosure: empty brackets are not allowed."); - } - return composite(exp); - }, - RegexOptions.IgnorePatternWhitespace); - - if(ret.IndexOf('(') != -1) - { - Log.Trace("Condition-disclosure: found a new bracket - '{0}'", ret); - - ++_depthBracketsLevel; - string dret = disclosure(ret); // not all disclosed - --_depthBracketsLevel; - - return dret; - } - return composite(ret); - } - - /// - /// Composite Conditions - /// - /// - /// - protected string composite(string data) - { - Log.Trace("Condition-composite: started with - '{0}'", data); - - //if(data.IndexOfAny(new char[] { '=', '>', '<', '!', '|', '&' }) == -1) { - // //TODO: without expression e.g.: 1 > (7) -> 1 > 7 - //} - //Log.Trace("Condition-composite: finding operators.."); - - int left = 0; - for(int i = 0, len = data.Length - 1; i < len; ) - { - char curr = data[i]; - char next = data[i + 1]; - if((curr == '|' && next != '|') - || - (curr == '&' && next != '&')) - { - throw new SyntaxIncorrectException("Condition-composite: allowed only logical operators - '&&' and '||'"); - } - - string exp = null; - if(curr == '|' || curr == '&') { - exp = data.Substring(left, i - left); - left = i += 2; - } - - if(curr == '|') - { - if(calculate(exp)) { - return Value.VTRUE; - } - - if(left >= len) { - return Value.VFALSE; - } - - continue; - } - - if(curr == '&') - { - if(calculate(exp)) { - continue; - } - - int orpos = data.IndexOf("||", left); - if(orpos == -1) { - return Value.VFALSE; - } - - left = i = (orpos + 2); - continue; // try with new block _x_|| -> ? - } - - ++i; - } - return calculate(data.Substring(left))? Value.VTRUE : Value.VFALSE; // -> ??? EOL - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/ConditionComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/ConditionComponent.cs deleted file mode 100644 index 66e07e1f..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/ConditionComponent.cs +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.MSBuild; -using net.r_eg.vsSBE.SBEScripts.Components.Condition; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - /// - /// Conditional statement for user scripts. - /// - [Definition("(true) { }", "Conditionals statements\n\n(1 > 2) {\n ... \n}")] - public class ConditionComponent: Component, IComponent - { - /// - /// Core of conditional expressions. - /// - protected Expression expression; - - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "("; } - } - - /// - /// To force post-analysis. - /// - public override bool PostParse - { - get { return true; } - } - - /// - /// Should be located before deepening - /// - public override bool BeforeDeepen - { - get { return true; } - } - - protected sealed class ConditionalExpression: Expression - { - private ConditionComponent cond; - - protected override string evaluate(string data) - { - return cond.evaluate(data); - } - - public ConditionalExpression(ConditionComponent cond, ISBEScript script, IMSBuild msbuild) - : base(script, msbuild) - { - this.cond = cond; - } - } - - /// - /// Main rule of container. - /// - protected string Rule - { - get - { - return String.Format(@"^\[\s* - {0} #1 - Condition - \s* - {1} #2 - Body if true - (?: - \s*else\s* - {1} #3 - Body if false (optional) - )?\s*\]", - RPattern.RoundBracketsContent, - RPattern.CurlyBracketsContent - ); - } - } - - /// - /// Compiled rule. - /// - protected Regex CRule - { - get - { - if(crule == null) { - crule = new Regex(Rule, - RegexOptions.IgnorePatternWhitespace | - RegexOptions.Compiled); - } - return crule; - } - } - private Regex crule; - - /// Used environment - /// Instance of user-variables - public ConditionComponent(IEnvironment env, IUserVariable uvariable) - : base(env, uvariable) - { - init(); - } - - /// Initialization with loader - public ConditionComponent(IBootloader loader) - : base(loader) - { - init(); - } - - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - var hString = new StringHandler(); - - Match m = CRule.Match(hString.protectMixedQuotes(data.Trim())); - if(!m.Success) { - throw new SyntaxIncorrectException("Failed ConditionComponent - '{0}'", data); - } - - string condition = hString.recovery(m.Groups[1].Value); - string bodyIfTrue = hString.recovery(m.Groups[2].Value); - string bodyIfFalse = (m.Groups[3].Success)? hString.recovery(m.Groups[3].Value) : Value.Empty; - - return parse(condition, bodyIfTrue, bodyIfFalse); - } - - protected string parse(string condition, string ifTrue, string ifFalse) - { - Log.Trace("Condition-parse: started with - '{0}' :: '{1}' :: '{2}'", condition, ifTrue, ifFalse); - return expression.isTrue(condition) ? ifTrue : ifFalse; - } - - protected void init() - { - expression = new ConditionalExpression(this, script, msbuild); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/DTEComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/DTEComponent.cs deleted file mode 100644 index ede99622..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/DTEComponent.cs +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using net.r_eg.vsSBE.Actions; -using net.r_eg.vsSBE.Events.CommandEvents; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - [Component("DTE", "For work with EnvDTE.\nAssembly-wrapped COM library containing the objects and members for Visual Studio core automation.\n- http://msdn.microsoft.com/en-us/library/EnvDTE.aspx")] - public class DTEComponent: Component, IComponent - { - /// - /// Provides command-events for automation clients. - /// - protected EnvDTE.CommandEvents cmdEvents; - - /// - /// The last received command from EnvDTE. - /// - protected volatile IFilter lastCommandEvent = new Filter(); - - /// - /// Work with commands. - /// - protected DTEOperation dteo; - - /// - /// object synch. - /// - private Object _lock = new Object(); - - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "DTE "; } - } - - /// - /// Ability of work with CommandEvent. - /// - protected bool IsAvaialbleCommandEvent - { - get { return env != null && env.Events != null; } - } - - /// Used environment - public DTEComponent(IEnvironment env) - : base(env) - { - dteo = new DTEOperation(env, Events.SolutionEventType.General); - attachCommandEvents(); - } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - var point = entryPoint(data); - string subtype = point.Key; - string request = point.Value; - - Log.Trace("`{0}`: subtype - `{1}`, request - `{2}`", ToString(), subtype, request); - - switch(subtype) - { - case "exec": { - return stExec(new PM(request)); - } - case "events": { - return stEvents(new PM(request)); - } - } - - throw new SubtypeNotFoundException("Subtype `{0}` is not found", subtype); - } - - /// - /// DTE-command to execution - /// e.g: #[DTE exec: command(arg)] - /// - /// - /// found command - [Property("exec", "DTE-command to execution, e.g.: exec: command(arg)", CValueType.Void, CValueType.Input)] - protected string stExec(IPM pm) - { - if(!pm.It(LevelType.Property, "exec") || !pm.IsRight(LevelType.RightOperandColon)) { - throw new IncorrectNodeException(pm); - } - - string cmd = pm.FirstLevel.Data.Trim(); - if(String.IsNullOrWhiteSpace(cmd)) { - throw new InvalidArgumentException("The command cannot be empty."); - } - Log.Debug("Execute command `{0}`", cmd); - - dteo.exec(new string[] { cmd }, false); - return Value.Empty; - } - - /// - /// For work with available events. - /// #[DTE events] - /// - /// - /// - [Property("events", "Operations with events.", CValueType.Void, CValueType.Void)] - protected string stEvents(IPM pm) - { - if(!pm.It(LevelType.Property, "events")) { - throw new IncorrectNodeException(pm); - } - - if(pm.It(LevelType.Property, "LastCommand")) { - return stLastCommand(pm); - } - - throw new IncorrectNodeException(pm); - } - - /// - /// Last received command from EnvDTE - /// - /// - /// - [Property("LastCommand", "The last received command.", "events", "stEvents")] - [Property("Guid", "Scope of Command ID", "LastCommand", "stLastCommand", CValueType.String)] - [Property("Id", "Command ID", "LastCommand", "stLastCommand", CValueType.Integer)] - [Property("CustomIn", "Custom input parameters.", "LastCommand", "stLastCommand", CValueType.Object)] - [Property("CustomOut", "Custom output parameters.", "LastCommand", "stLastCommand", CValueType.Object)] - [Property("Pre", "Flag of execution of the command - Before / After", "LastCommand", "stLastCommand", CValueType.Boolean)] - protected string stLastCommand(IPM pm) - { - if(!IsAvaialbleCommandEvent) { - throw new NotSupportedOperationException("CommandEvents: aren't available for current context. Use full environment."); - } - - if(pm.FinalEmptyIs(LevelType.Property, "Guid")) { - return (lastCommandEvent.Guid) ?? Value.Empty; - } - - if(pm.FinalEmptyIs(LevelType.Property, "Id")) { - return Value.from(lastCommandEvent.Id); - } - - if(pm.FinalEmptyIs(LevelType.Property, "CustomIn")) { - return Value.pack(lastCommandEvent.CustomIn) ?? Value.Empty; - } - - if(pm.FinalEmptyIs(LevelType.Property, "CustomOut")) { - return Value.pack(lastCommandEvent.CustomOut) ?? Value.Empty; - } - - if(pm.FinalEmptyIs(LevelType.Property, "Pre")) { - return Value.from(lastCommandEvent.Pre); // see commandEvent below - } - - throw new IncorrectNodeException(pm); - } - - protected void attachCommandEvents() - { - if(!IsAvaialbleCommandEvent || env.Events.CommandEvents == null) { - Log.Info("CommandEvents: aren't available for current context."); - return; //this can be for emulated DTE2 context - } - - cmdEvents = env.Events.CommandEvents; - lock(_lock) { - detachCommandEvents(); - cmdEvents.BeforeExecute += commandEventBefore; - cmdEvents.AfterExecute += commandEventAfter; - } - } - - protected void detachCommandEvents() - { - if(cmdEvents == null) { - return; - } - - lock(_lock) { - cmdEvents.BeforeExecute -= commandEventBefore; - cmdEvents.AfterExecute -= commandEventAfter; - } - } - - protected void commandEventBefore(string guid, int id, object customIn, object customOut, ref bool cancelDefault) - { - commandEvent(true, guid, id, customIn, customOut); - } - - protected void commandEventAfter(string guid, int id, object customIn, object customOut) - { - commandEvent(false, guid, id, customIn, customOut); - } - - private void commandEvent(bool pre, string guid, int id, object customIn, object customOut) - { - lastCommandEvent = new Filter() { - Guid = guid, - Id = id, - CustomIn = customIn, - CustomOut = customOut, - Pre = pre // only as flag (Before / After) for DTEComponent - }; - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/FileComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/FileComponent.cs deleted file mode 100644 index e8ef5ffb..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/FileComponent.cs +++ /dev/null @@ -1,1285 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Text; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.Extensions; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - /// - /// This is a very old component, so part of method signatures (user code) are left for compatibility 'as is'. - /// But, it can be changed for major release... - /// - [Component("File", new string[]{ "IO" }, "I/O File operations.")] - public class FileComponent: Component, IComponent - { - /// - /// Default limit in seconds for execution processes. - /// - public const int STCALL_TIMEOUT_DEFAULT = 10; - - /// - /// I/O Default encoding. - /// - protected Encoding defaultEncoding = new UTF8Encoding(false); - - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return @"(?:File|IO)\s"; } - } - - /// - /// Use regex engine for the Condition property - /// - public override bool CRegex - { - get { return true; } - } - - protected enum SearchType - { - Null, - Basic, - Regexp, - Wildcards - } - - /// - /// Get all directories from Environment PATH - /// - protected IEnumerable EnvPath - { - get - { - if(envPath == null) { - envPath = String.Format("{0};{1};{2};{3};{4}", - System.Environment.SystemDirectory, - System.Environment.GetEnvironmentVariable("SystemRoot"), - System.Environment.GetEnvironmentVariable("SystemRoot") + @"\System32\Wbem", - System.Environment.GetEnvironmentVariable("SystemRoot") + @"\System32\WindowsPowerShell\v1.0\", - System.Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process)).Split(';'); - } - - foreach(string dir in envPath) { - yield return dir; - } - } - } - protected string[] envPath = null; - - /// Initialize with loader - public FileComponent(IBootloader loader) - : base(loader) - { - - } - - public FileComponent() { } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - var point = entryPoint(data, RegexOptions.Singleline); - string subtype = point.Key; - string request = point.Value; - - Log.Trace("`{0}`: subtype - `{1}`, request - `{2}`", ToString(), subtype, request); - - IPM pm = new PM(request, msbuild); - - if(pm.IsData("get")) { - return stGet(pm); - } - if(pm.IsData("call", "out", "scall", "sout", "cmd")) { - return stCallFamily(pm); - } - if(pm.IsData("write", "append", "writeLine", "appendLine")) { - return stWriteFamily(pm); - } - if(pm.IsData("replace")) { - return stReplace(pm); - } - if(pm.IsData("exists")) { - return stExists(pm); - } - if(pm.IsData("remote")) { - return stRemote(pm); - } - if(pm.IsData("copy")) { - return stCopy(pm); - } - if(pm.IsData("delete")) { - return stDelete(pm); - } - - throw new IncorrectNodeException(pm); - } - - [Method("get", - "Get all data from text file.", - new string[] { "name" }, - new string[] { "File name" }, - CValueType.String, - CValueType.String - )] - protected string stGet(IPM pm) - { - if(!pm.FinalEmptyIs(LevelType.Method, "get")) { - throw new IncorrectNodeException(pm); - } - ILevel level = pm.FirstLevel; - - if(!level.Is(ArgumentType.StringDouble)) { - throw new ArgumentPMException(level, "get(string name)"); - } - string file = location((string)level.Args[0].data); - - try { - return readToEnd(file, detectEncodingFromFile(file)); - } - catch(FileNotFoundException ex) { - throw new ScriptException("File '{0}' is not found :: `{1}`", file, ex.Message); - } - } - - /// - /// - protected string stCallFamily(IPM pm) - { - if(pm.FinalEmptyIs(LevelType.Method, "call")) { - return stCall(pm, false, false); - } - - if(pm.FinalEmptyIs(LevelType.Method, "out")) { - //return stCall(pm, true, false); obsolete - return stCall(pm, true, true); // redirect to sout - } - - if(pm.FinalEmptyIs(LevelType.Method, "scall")) { - return stCall(pm, false, true); - } - - if(pm.FinalEmptyIs(LevelType.Method, "sout")) { - return stCall(pm, true, true); - } - - if(pm.FinalEmptyIs(LevelType.Method, "cmd")) { - return stCmd(pm); - } - - throw new IncorrectNodeException(pm); - } - - /// - /// Use StandardOutput or not - /// Silent mode - /// Received data from StandardOutput - [Method("call", - "Caller of executable files.", - new string[] { "name" }, - new string[] { "Executable file" }, - CValueType.Void, - CValueType.String - )] - [Method("call", - "Caller of executable files with arguments.", - new string[] { "name", "args" }, - new string[] { "Executable file", "Arguments" }, - CValueType.Void, - CValueType.String, CValueType.String - )] - [Method("call", - "Caller of executable files with arguments and time limitation settings.", - new string[] { "name", "args", "timeout" }, - new string[] { "Executable file", "Arguments", "How long to wait the execution, in seconds. 0 value - infinitely" }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.Integer - )] - [Method("scall", - "Caller of executable files in silent mode.", - new string[] { "name" }, - new string[] { "Executable file" }, - CValueType.Void, - CValueType.String - )] - [Method("scall", - "Caller of executable files in silent mode with arguments.", - new string[] { "name", "args" }, - new string[] { "Executable file", "Arguments" }, - CValueType.Void, - CValueType.String, CValueType.String - )] - [Method("scall", - "Caller of executable files in silent mode with arguments and time limitation settings.", - new string[] { "name", "args", "timeout" }, - new string[] { "Executable file", "Arguments", "How long to wait the execution, in seconds. 0 value - infinitely" }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.Integer - )] - [Method("sout", - "Receives data from standard streams for executed file.\nTo disable errors use the '2>nul' and similar.", - new string[] { "name" }, - new string[] { "Executable file" }, - CValueType.String, - CValueType.String - )] - [Method("sout", - "Receives data from standard streams for executed file with arguments.\nTo disable errors use the '2>nul' and similar.", - new string[] { "name", "args" }, - new string[] { "Executable file", "Arguments" }, - CValueType.String, - CValueType.String, CValueType.String - )] - [Method("sout", - "Receives data from standard streams for executed file with arguments and time limitation settings.\nTo disable errors use the '2>nul' and similar.", - new string[] { "name", "args", "timeout" }, - new string[] { "Executable file", "Arguments", "How long to wait the execution, in seconds. 0 value - infinitely" }, - CValueType.String, - CValueType.String, CValueType.String, CValueType.Integer - )] - protected string stCall(IPM pm, bool stdOut, bool silent) - { - ILevel level = pm.FirstLevel; - - string file; - string args = String.Empty; - int timeout = STCALL_TIMEOUT_DEFAULT; - - if(level.Is(ArgumentType.StringDouble)) { - file = (string)level.Args[0].data; - } - else if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble)) { - file = (string)level.Args[0].data; - args = (string)level.Args[1].data; - } - else if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.Integer)) { - file = (string)level.Args[0].data; - args = (string)level.Args[1].data; - timeout = (int)level.Args[2].data; - } - else { - throw new ArgumentPMException(level, level.Data + "(string filename [, string args [, uinteger timeout]])"); - } - - string pfile = findFile(file); - if(String.IsNullOrEmpty(pfile)) { - throw new NotFoundException("File '{0}' was not found.", file); - } - return run(pfile, args, silent, stdOut, timeout); - } - - /// - /// Alias to sout() for cmd - /// - #[File cmd("args")] -> #[File sout("cmd", "/C args")] - /// - [Method("cmd", - "Alias to #[File sout(\"cmd\", \"/C args\")] \nReceives data from standard streams for cmd process with arguments.", - new string[] { "args" }, - new string[] { "Arguments" }, - CValueType.String, - CValueType.String - )] - [Method("cmd", - "Alias to #[File sout(\"cmd\", \"/C args\", timeout)] \nReceives data from standard streams for cmd process with arguments and time limitation settings.", - new string[] { "args", "timeout" }, - new string[] { "Arguments", "How long to wait the execution, in seconds. 0 value - infinitely" }, - CValueType.String, - CValueType.String, CValueType.Integer - )] - protected string stCmd(IPM pm) - { - ILevel origin = pm.FirstLevel; - - if(origin.Is(ArgumentType.StringDouble)) - { - pm.FirstLevel = new Level() { - Type = LevelType.Method, - DataType = origin.DataType, - Data = "sout", - Args = new[] { - new Argument() { data = "cmd", type = ArgumentType.StringDouble }, - new Argument() { data = "/C " + origin.Args[0].data, type = ArgumentType.StringDouble } - }, - }; - } - else if(origin.Is(ArgumentType.StringDouble, ArgumentType.Integer)) - { - pm.FirstLevel = new Level() { - Type = LevelType.Method, - DataType = origin.DataType, - Data = "sout", - Args = new[] { - new Argument() { data = "cmd", type = ArgumentType.StringDouble }, - new Argument() { data = "/C " + origin.Args[0].data, type = ArgumentType.StringDouble }, - new Argument() { data = origin.Args[1].data, type = ArgumentType.Integer }, - }, - }; - } - else { - throw new ArgumentPMException(origin, "string cmd(string args [, integer timeout])"); - } - - Log.Trace("stCmd redirect to stCall"); - return stCall(pm, true, true); - } - - /// - /// - protected string stWriteFamily(IPM pm) - { - if(pm.FinalIs(LevelType.Method, "write")) { - return stWrite(pm, false, false); - } - if(pm.FinalIs(LevelType.Method, "append")) { - return stWrite(pm, true, false); - } - if(pm.FinalIs(LevelType.Method, "writeLine")) { - return stWrite(pm, false, true); - } - if(pm.FinalIs(LevelType.Method, "appendLine")) { - return stWrite(pm, true, true); - } - - throw new IncorrectNodeException(pm); - } - - /// - /// Flag to append the content to the end of the file. - /// To write with newline. - /// Encoding. - [Method("write", - "To write data in a text file.\n * Creates if the file does not exist.\n * Overwrites content if it already exists.", - new string[] { "name", "In" }, - new string[] { "File name or standard stream: STDOUT, STDERR", "mixed data" }, - CValueType.Void, - CValueType.String, CValueType.Input - )] - [Method("writeLine", - "To write data with newline in a text file.\n * Creates if the file does not exist.\n * Overwrites content if it already exists.", - new string[] { "name", "In" }, - new string[] { "File name or standard stream: STDOUT, STDERR", "mixed data" }, - CValueType.Void, - CValueType.String, CValueType.Input - )] - [Method("write", - "To write data in a text file with selected encoding and flags.\n * Creates if the file does not exist.", - new string[] { "name", "append", "newline", "encoding", "In" }, - new string[] { "File name or standard stream: STDOUT, STDERR", - "Flag to append the content to the end of the file", - "To write with newline", - "Preferred encoding", - "mixed data" }, - CValueType.Void, - CValueType.String, CValueType.Boolean, CValueType.Boolean, CValueType.String, CValueType.Input - )] - [Method("append", - "To append data to the end of a text file or create new if file does not exist.", - new string[] { "name", "In" }, - new string[] { "File name", "mixed data" }, - CValueType.Void, - CValueType.String, CValueType.Input - )] - [Method("appendLine", - "To append data with newline to the end of a text file or create new if file does not exist.", - new string[] { "name", "In" }, - new string[] { "File name", "mixed data" }, - CValueType.Void, - CValueType.String, CValueType.Input - )] - protected string stWrite(IPM pm, bool append, bool newline, Encoding enc) - { - ILevel level = pm.FirstLevel; - - string file = null; - string std = null; - - // basic method signatures - - if(level.Is(ArgumentType.StringDouble) && pm.IsData("write", "writeLine", "append", "appendLine")) { - file = (string)level.Args[0].data; - } - else if(level.Is(ArgumentType.StringDouble, ArgumentType.Boolean, ArgumentType.Boolean, ArgumentType.StringDouble) && pm.IsData("write")) { - file = (string)level.Args[0].data; - append = (bool)level.Args[1].data; - newline = (bool)level.Args[2].data; - enc = encoding((string)level.Args[3].data); - } - else if(level.Is(ArgumentType.EnumOrConst) && pm.IsData("write", "writeLine")) { - std = (string)level.Args[0].data; - } - else if(level.Is(ArgumentType.EnumOrConst, ArgumentType.Boolean, ArgumentType.Boolean, ArgumentType.StringDouble) && pm.IsData("write")) { - std = (string)level.Args[0].data; - append = (bool)level.Args[1].data; - newline = (bool)level.Args[2].data; - enc = encoding((string)level.Args[3].data); - } - else { - throw new ArgumentPMException(level, "write( (string name | const STD) [, boolean append, boolean newline, string encoding]); writeLine(string name | const STD); append/appendLine(string name)"); - } - - // content - - string fdata; - if(pm.Levels[1].Type == LevelType.RightOperandColon) { - fdata = pm.Levels[1].Data; - } - else { - throw new IncorrectNodeException(pm); - } - - // Text file - - if(file != null) - { - file = location(file); - writeToFile(file, fdata, append, newline, enc); - - Log.Trace("The data:{0} is successfully written - `{1}` : {2}, {3}, '{4}'", - fdata.Length, file, append, newline, enc.EncodingName); - - return Value.Empty; - } - - // Streams - - switch(std) { - case "STDERR": { - writeToStdErr(fdata, newline); - return Value.Empty; - } - case "STDOUT": { - writeToStdOut(fdata, newline); - return Value.Empty; - } - default: { - throw new InvalidArgumentException("Incorrect stream type `{0}`", std); - } - } - - throw new IncorrectNodeException(pm); - } - - protected string stWrite(IPM pm, bool append, bool newline) - { - return stWrite(pm, append, newline, defaultEncoding); - } - - [Method("replace", - "To replace data in files.", - new string[] { "file", "pattern", "replacement" }, - new string[] { "Input file", "String to compare", "New data" }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.String - )] - [Property("replace", "Provides additional replacement methods.")] - [Method("Regex", - "Alias for Regexp.", - "replace", "stReplace", - new string[] { "file", "pattern", "replacement" }, - new string[] { "Input file", "Regular expression pattern", "Replacement pattern" }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.String - )] - [Method("Regexp", - "To replace data in files with Regular Expression Language.", - "replace", "stReplace", - new string[] { "file", "pattern", "replacement" }, - new string[] { "Input file", "Regular expression pattern", "Replacement pattern." }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.String - )] - [Method("Wildcards", - "To replace data in files with Wildcards.", - "replace", "stReplace", - new string[] { "file", "pattern", "replacement" }, - new string[] { "Input file", "Pattern with wildcards", "New data" }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.String - )] - protected string stReplace(IPM pm) - { - SearchType type = SearchType.Null; - - // the old signatures - - if(pm.FinalEmptyIs(LevelType.Method, "replace")) { - // replace(...) - type = SearchType.Basic; - } - else if(pm.It(LevelType.Property, "replace")) - { - if(pm.FinalEmptyIs(LevelType.Method, "Regex") || pm.FinalEmptyIs(LevelType.Method, "Regexp")) { - // replace.Regex(...) & replace.Regexp(...) - type = SearchType.Regexp; - } - else if(pm.FinalEmptyIs(LevelType.Method, "Wildcards")) { - // replace.Wildcards(...) - type = SearchType.Wildcards; - } - } - - if(type == SearchType.Null) { - throw new IncorrectNodeException(pm); - } - - // arguments - - ILevel level = pm.FirstLevel; - - if(!level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.StringDouble)) { - throw new ArgumentPMException(level, "(string file, string pattern, string replacement)"); - } - - string file = location((string)level.Args[0].data); - string pattern = (string)level.Args[1].data; - string replacement = (string)level.Args[2].data; - - Log.Trace("stReplace: found file '{0}', pattern '{1}', replacement '{2}'", file, pattern, replacement); - - Encoding enc = detectEncodingFromFile(file); - string content = readToEnd(file, enc); - - Log.Debug("stReplace: type '{0}' :: received '{1}', Encoding '{2}'", type, content.Length, enc); - content = stReplaceEngine(type, ref content, pattern, replacement); - - writeToFile(file, content, false, enc); - return Value.Empty; - } - - /// search type - /// - /// - /// - protected string stReplaceEngine(SearchType type, ref string content, string pattern, string replacement) - { - switch(type) { - case SearchType.Regexp: { - return Regex.Replace(content, pattern, replacement); - } - case SearchType.Wildcards: { - string stub = Regex.Escape(pattern).Replace("\\*", ".*?").Replace("\\+", ".+?").Replace("\\?", "."); - return Regex.Replace(content, stub, replacement); - } - default: { - return content.Replace(pattern, replacement); - } - } - } - - [Property("exists", "Determines whether the something exists.")] - [Method("directory", - "Determines whether the given path refers to an existing directory on disk.", - "exists", "stExists", - new string[] { "path" }, - new string[] { "Path to directory" }, - CValueType.Boolean, - CValueType.String - )] - [Method("directory", - "Determines whether the given path refers to an existing directory on disk. Searching with Environment path.", - "exists", "stExists", - new string[] { "path", "environment" }, - new string[] { "Path to directory", "Use Environment PATH (Associated for current process)." }, - CValueType.Boolean, - CValueType.String, CValueType.Boolean - )] - [Method("file", - "Determines whether the specified file exists.", - "exists", "stExists", - new string[] { "path" }, - new string[] { "Path to file" }, - CValueType.Boolean, - CValueType.String - )] - [Method("file", - "Determines whether the specified file exists. Searching with Environment path.", - "exists", "stExists", - new string[] { "path", "environment" }, - new string[] { "Path to file", "Use Environment PATH (Associated for current process)." }, - CValueType.Boolean, - CValueType.String, CValueType.Boolean - )] - protected string stExists(IPM pm) - { - if(!pm.It(LevelType.Property, "exists")) { - throw new IncorrectNodeException(pm); - } - ILevel level = pm.FirstLevel; - - if(!pm.FinalEmptyIs(LevelType.Method, "directory") - && !pm.FinalEmptyIs(LevelType.Method, "file")) - { - throw new IncorrectNodeException(pm); - } - - if(level.Is(ArgumentType.StringDouble)) { - return stExists(pm.IsData("file"), (string)level.Args[0].data, false); - } - if(level.Is(ArgumentType.StringDouble, ArgumentType.Boolean)) { - return stExists(pm.IsData("file"), (string)level.Args[0].data, (bool)level.Args[1].data); - } - - throw new ArgumentPMException(level, level.Data + "(string path [, boolean environment])"); - } - - protected string stExists(bool tFile, string item, bool environment) - { - if(!environment) { - return Value.from((tFile)? File.Exists(location(item)) : Directory.Exists(location(item))); - } - - foreach(string dir in EnvPath) - { - bool found = (tFile)? File.Exists(location(item, dir)) : Directory.Exists(location(item, dir)); - if(found) { - return Value.from(true); - } - } - - return Value.from(false); - } - - [Property("remote", "Remote servers.")] - [Method("download", - "To download file from remote server.", - "remote", "stRemote", - new string[] { "addr", "output" }, - new string[] { "Full address to remote file. e.g.: ftp://... http://...", "Output file name." }, - CValueType.Void, - CValueType.String, CValueType.String - )] - [Method("download", - "To download file from remote server.", - "remote", "stRemote", - new string[] { "addr", "output", "user", "pwd" }, - new string[] { "Full address to remote file. e.g.: ftp://... http://...", "Output file name.", "Username", "Password" }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.String, CValueType.String - )] - protected string stRemote(IPM pm) - { - if(!pm.It(LevelType.Property, "remote")) { - throw new IncorrectNodeException(pm); - } - ILevel level = pm.FirstLevel; - - if(pm.FinalEmptyIs(LevelType.Method, "download")) - { - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble)) { - return download((string)level.Args[0].data, (string)level.Args[1].data); - } - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.StringDouble)) { - return download((string)level.Args[0].data, (string)level.Args[1].data, (string)level.Args[2].data, (string)level.Args[3].data); - } - - throw new ArgumentPMException(level, "(string addr, string output [, string user, string pwd])"); - } - - throw new IncorrectNodeException(pm); - } - - protected virtual string download(string addr, string output, string user = null, string pwd = null) - { - var wc = new WebClient(); - if(user != null) { - wc.Credentials = new NetworkCredential(user, pwd ?? ""); - } - - wc.DownloadFile(addr, location(output)); - return Value.Empty; - } - - [Property("copy", "The copy operations.")] - protected string stCopy(IPM pm) - { - if(!pm.It(LevelType.Property, "copy")) { - throw new IncorrectNodeException(pm); - } - ILevel level = pm.FirstLevel; - - if(pm.FinalEmptyIs(LevelType.Method, "file")) { - return copyFile(level, pm); - } - if(pm.FinalEmptyIs(LevelType.Method, "directory")) { - return copyDirectory(level, pm); - } - - throw new IncorrectNodeException(pm); - } - - /// - /// `copy.file((string src | object src), string dest, bool overwrite [, object except])` - /// - [Method("file", - "To copy selected file to the destination. Creates the destination path if not exists.", - "copy", "stCopy", - new string[] { "src", "dest", "overwrite" }, - new string[] { "Source file. May contain mask as *.dll, *.*, ...", - "The destination path. May contain path to file or directory (end with \\ or /).", - "Overwrite file/s if already exists." }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.Boolean - )] - [Method("file", - "To copy selected file to the destination. Creates the destination path if not exists.", - "copy", "stCopy", - new string[] { "src", "dest", "overwrite", "except" }, - new string[] { "Source file. May contain mask as *.dll, *.*, ...", - "The destination path. May contain path to file or directory (end with \\ or /).", - "Overwrite file/s if already exists.", - "List of files to exclude from input source as {\"f1\", \"path\\*.dll\", ...}" }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.Boolean, CValueType.Object - )] - [Method("file", - "To copy selected files to the destination. Creates the destination path if not exists.", - "copy", "stCopy", - new string[] { "srclist", "dest", "overwrite" }, - new string[] { "List of source files as {\"f1\", \"path\\*.dll\", ..}", - "The destination path. Should contain path to directory.", - "Overwrite file/s if already exists." }, - CValueType.Void, - CValueType.Object, CValueType.String, CValueType.Boolean - )] - [Method("file", - "To copy selected files to the destination. Creates the destination path if not exists.", - "copy", "stCopy", - new string[] { "srclist", "dest", "overwrite", "except" }, - new string[] { "List of source files as {\"f1\", \"path\\*.dll\", ..}", - "The destination path. Should contain path to directory.", - "Overwrite file/s if already exists.", - "List of files to exclude from input source as {\"f1\", \"path\\*.dll\", ...}" }, - CValueType.Void, - CValueType.Object, CValueType.String, CValueType.Boolean, CValueType.Object - )] - protected string copyFile(ILevel level, IPM pm) - { - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.Boolean)) { - return copyFile(pm.pinTo(1), (string)level.Args[0].data, (string)level.Args[1].data, (bool)level.Args[2].data); - } - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.Boolean, ArgumentType.Object)) { - return copyFile(pm.pinTo(1), (string)level.Args[0].data, (string)level.Args[1].data, (bool)level.Args[2].data, (Argument[])level.Args[3].data); - } - if(level.Is(ArgumentType.Object, ArgumentType.StringDouble, ArgumentType.Boolean)) { - return copyFile(pm.pinTo(1), (Argument[])level.Args[0].data, (string)level.Args[1].data, (bool)level.Args[2].data); - } - if(level.Is(ArgumentType.Object, ArgumentType.StringDouble, ArgumentType.Boolean, ArgumentType.Object)) { - return copyFile(pm.pinTo(1), (Argument[])level.Args[0].data, (string)level.Args[1].data, (bool)level.Args[2].data, (Argument[])level.Args[3].data); - } - - throw new ArgumentPMException(level, "copy.file((string src | object srclist), string dest, bool overwrite [, object except])"); - } - - protected string copyFile(IPM pm, Argument[] files, string dest, bool overwrite, Argument[] except = null) - { - dest = dest.PathFormat(); - - foreach(Argument src in files) { - if(src.type != ArgumentType.StringDouble) { - throw new InvalidArgumentException("Incorrect data from input files. Define as {\"f1\", \"f2\", ...}"); - } - copyFile(pm, src.data.ToString(), dest, overwrite, except); - } - - return Value.Empty; - } - - protected string copyFile(IPM pm, string src, string dest, bool overwrite, Argument[] except = null) - { - if(String.IsNullOrWhiteSpace(src) || String.IsNullOrWhiteSpace(dest)) { - throw new InvalidArgumentException("The source file or the destination path argument is empty."); - } - - if(except != null && except.Any(p => p.type != ArgumentType.StringDouble)) { - throw new InvalidArgumentException("Incorrect data from the 'except' argument. Define as {\"f1\", \"f2\", ...}"); - } - - dest = location(dest.TrimEnd()); - string destDir = Path.GetDirectoryName(dest); - string destFile = Path.GetFileName(dest); - - src = location(src); - string[] input = new[] { src }.ExtractFiles(); -#if DEBUG - Log.Trace("Found files to copy `{0}`", String.Join(", ", input)); -#endif - if(except != null) { - string path = Path.GetDirectoryName(src); - input = input.Except(except - .Where(f => !String.IsNullOrWhiteSpace((string)f.data)) - .Select(f => location((string)f.data, path)) - .ToArray() - .ExtractFiles() - ).ToArray(); - } - - if(input.Length < 1) { - throw new InvalidArgumentException("The input files was not found. Check your mask and the exception list if used."); - } - - copyFile(destDir, destFile, overwrite, input); - return Value.Empty; - } - - protected virtual void copyFile(string destDir, string destFile, bool overwrite, params string[] files) - { - if(!Directory.Exists(destDir)) { - Log.Trace("Trying to create directory `{0}`", destDir); - Directory.CreateDirectory(destDir); - } - - bool isDestFile = !String.IsNullOrWhiteSpace(destFile); - if(isDestFile && files.Length > 1) { - throw new InvalidArgumentException("The destination path `{0}` cannot contain file name `{1}` if the source has 2 or more files for used mask. End with `{1}\\` or `{1}/` if it directory.", destDir, destFile); - } - - foreach(string file in files) { - string dest = Path.Combine(destDir, isDestFile ? destFile : Path.GetFileName(file)); - Log.Trace("Copy file `{0}` to `{1}` overwrite({2})", file, dest, overwrite); - File.Copy(file, dest, overwrite); - } - } - - /// - /// `copy.directory(string src, string dest, bool force [, bool overwrite])` - /// - [Method("directory", - "To copy selected directory and subdirectories to the destination.", - "copy", "stCopy", - new string[] { "src", "dest", "force" }, - new string[] { "The source directory. Can be empty as new directory.", "The destination directory.", "Create the destination path if not exists." }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.Boolean - )] - [Method("directory", - "To copy selected directory and subdirectories to the destination.", - "copy", "stCopy", - new string[] { "src", "dest", "force", "overwrite" }, - new string[] { "The source directory. Can be empty as new directory.", - "The destination directory.", - "Create the destination path if not exists.", - "Overwrite files if already exists." }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.Boolean, CValueType.Boolean - )] - protected string copyDirectory(ILevel level, IPM pm) - { - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.Boolean)) { - return copyDirectory(pm.pinTo(1), (string)level.Args[0].data, (string)level.Args[1].data, (bool)level.Args[2].data); - } - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.Boolean, ArgumentType.Boolean)) { - return copyDirectory(pm.pinTo(1), (string)level.Args[0].data, (string)level.Args[1].data, (bool)level.Args[2].data, (bool)level.Args[3].data); - } - - throw new ArgumentPMException(level, "copy.directory(string src, string dest, bool force [, bool overwrite])"); - } - - protected string copyDirectory(IPM pm, string src, string dest, bool force, bool overwrite = false) - { - if(String.IsNullOrWhiteSpace(dest)) { - throw new InvalidArgumentException("The destination directory argument is empty."); - } - - dest = Path.GetDirectoryName(location(dest.PathFormat())); - - if(String.IsNullOrWhiteSpace(src)) { - if(force) { - mkdir(dest); - return Value.Empty; - } - throw new InvalidArgumentException("Use `force` flag if you want to create directory `{0}`", dest); - } - - src = location(src.PathFormat()); - - var files = Directory.EnumerateFiles(src, "*.*", SearchOption.AllDirectories) - .Select(f => new[] { f, Path.Combine(dest, f.Substring(src.Length)) }); - - copyDirectory(files, dest, force, overwrite); - return Value.Empty; - } - - protected virtual void copyDirectory(IEnumerable files, string dest, bool force, bool overwrite) - { - if(!Directory.Exists(dest)) { - if(!force) { - throw new NotFoundException("Part of path `{0}` of the destination directory is not exists. Check path or use `force` flag", dest); - } - Log.Trace("Trying to create directory `{0}`", dest); - Directory.CreateDirectory(dest); - } - - foreach(var file in files.ToArray()) - { - string from = file[0]; - string to = file[1]; - - string subdir = Path.GetDirectoryName(to); - if(!Directory.Exists(subdir)) { - Directory.CreateDirectory(subdir); - } - - Log.Trace("Copy directory: file `{0}` to `{1}` overwrite({2})", from, to, overwrite); - File.Copy(from, to, overwrite); - } - } - - [Property("delete", "The delete operations.")] - protected string stDelete(IPM pm) - { - if(!pm.It(LevelType.Property, "delete")) { - throw new IncorrectNodeException(pm); - } - ILevel level = pm.FirstLevel; - - if(pm.FinalEmptyIs(LevelType.Method, "files")) { - return deleteFiles(level, pm); - } - if(pm.FinalEmptyIs(LevelType.Method, "directory")) { - return deleteDirectory(level, pm); - } - - throw new IncorrectNodeException(pm); - } - - /// - /// `delete.files(object files [, object except])` - /// - [Method("files", - "To delete selected files.", - "delete", "stDelete", - new string[] { "files" }, - new string[] { "List of files to deletion as {\"f1\", \"path\\*.dll\", ..}" }, - CValueType.Void, - CValueType.Object - )] - [Method("files", - "To delete selected files.", - "delete", "stDelete", - new string[] { "files", "except" }, - new string[] { "List of files to deletion as {\"f1\", \"path\\*.dll\", ..}", "List of files to exclude from input list." }, - CValueType.Void, - CValueType.Object, CValueType.Object - )] - protected string deleteFiles(ILevel level, IPM pm) - { - if(level.Is(ArgumentType.Object)) { - return deleteFiles(pm.pinTo(1), (Argument[])level.Args[0].data); - } - if(level.Is(ArgumentType.Object, ArgumentType.Object)) { - return deleteFiles(pm.pinTo(1), (Argument[])level.Args[0].data, (Argument[])level.Args[1].data); - } - - throw new ArgumentPMException(level, "delete.files(object files [, object except])"); - } - - protected string deleteFiles(IPM pm, Argument[] files, Argument[] except = null) - { - if(files.Any(p => p.type != ArgumentType.StringDouble)) { - throw new InvalidArgumentException("Incorrect data from input files. Define as {\"f1\", \"f2\", ...}"); - } - - if(except != null && except.Any(p => p.type != ArgumentType.StringDouble)) { - throw new InvalidArgumentException("Incorrect data from the 'except' argument. Define as {\"f1\", \"f2\", ...}"); - } - - Func exs = delegate(string file, int idx) { - if(!String.IsNullOrWhiteSpace(file)) { - return location(file); - } - throw new InvalidArgumentException("File name is empty. Fail in '{0}' position.", idx); - }; - - string[] input = files.Select((f, i) => exs((string)f.data, i)).ToArray().ExtractFiles(); -#if DEBUG - Log.Trace("deleteFiles: Found files `{0}`", String.Join(", ", input)); -#endif - if(except != null) { - input = input.Except(except - .Where(f => !String.IsNullOrWhiteSpace((string)f.data)) - .Select(f => location((string)f.data)) - .ToArray() - .ExtractFiles() - ).ToArray(); - } - - if(input.Length < 1) { - throw new InvalidArgumentException("The input files was not found. Check your mask and the exception list if used."); - } - - deleteFiles(input); - return Value.Empty; - } - - protected virtual void deleteFiles(string[] files) - { - foreach(string file in files) { - Log.Trace("Delete file `{0}`", file); - File.Delete(file); - } - } - - /// - /// `delete.directory(string dir, bool force)` - /// - [Method("directory", - "To delete selected directory.", - "delete", "stDelete", - new string[] { "dir", "force" }, - new string[] { "Path to directory for deletion.", "To remove non-empty directories." }, - CValueType.Void, - CValueType.String, CValueType.Boolean - )] - protected string deleteDirectory(ILevel level, IPM pm) - { - if(level.Is(ArgumentType.StringDouble, ArgumentType.Boolean)) { - return deleteDirectory(pm.pinTo(1), (string)level.Args[0].data, (bool)level.Args[1].data); - } - - throw new ArgumentPMException(level, "delete.directory(string dir, bool force)"); - } - - protected string deleteDirectory(IPM pm, string src, bool force) - { - if(String.IsNullOrWhiteSpace(src)) { - throw new InvalidArgumentException("The source directory is empty."); - } - deleteDirectory(location(src), force); - return Value.Empty; - } - - protected virtual void deleteDirectory(string src, bool force) - { - Log.Trace("Delete directory `{0}` /force: {1}", src, force); - if(Directory.Exists(src)) { // to avoid errors.. like `File.Delete` - Directory.Delete(src, force); - } - } - - protected virtual void mkdir(string path) - { - if(!Directory.Exists(path)) { - Log.Trace("Create empty directory `{0}`", path); - Directory.CreateDirectory(path); - } - } - - /// The file to be read - /// The character encoding - /// Indicates whether to look for byte order marks at the beginning of the file - protected virtual string readToEnd(string file, Encoding enc, bool detectEncoding = false) - { - using(StreamReader stream = new StreamReader(file, enc, detectEncoding)) { - return stream.ReadToEnd(); - } - } - - protected string readToEnd(string file) - { - return readToEnd(file, defaultEncoding, true); - } - - /// - /// - /// Flag to append the content to the end of the file - /// To write with newline if true - /// The character encoding - protected virtual void writeToFile(string file, string data, bool append, bool newline, Encoding enc) - { -#if DEBUG - Log.Trace("File `{0}` write with Encoding '{1}'", file, enc.EncodingName); -#endif - using(TextWriter stream = new StreamWriter(file, append, enc)) { - if(newline) { - stream.WriteLine(data); - } - else { - stream.Write(data); - } - } - } - - protected void writeToFile(string file, string data, bool append, bool newline) - { - writeToFile(file, data, append, newline, defaultEncoding); - } - - protected void writeToFile(string file, string data, bool append, Encoding enc) - { - writeToFile(file, data, append, false, enc); - } - - /// - /// Write into standard output stream. - /// - /// - /// To write with newline if true - protected void writeToStdOut(string data, bool newline) - { - if(newline) { - Console.Out.WriteLine(data); - } - else { - Console.Out.Write(data); - } - } - - /// - /// Write into standard error stream. - /// - /// - /// To write with newline if true - protected void writeToStdErr(string data, bool newline) - { - if(newline) { - Console.Error.WriteLine(data); - } - else { - Console.Error.Write(data); - } - } - - /// - /// Auto detecting encoding from the file. - /// - protected virtual Encoding detectEncodingFromFile(string file) - { - using(FileStream fs = File.OpenRead(file)) - { - Ude.CharsetDetector cdet = new Ude.CharsetDetector(); - cdet.Feed(fs); - cdet.DataEnd(); - - if(cdet.Charset == null) { - //throw new ComponentException("Ude: Detection failed for '{0}'", file); - Log.Warn("Problem with detection of encoding for '{0}'", file); - return defaultEncoding; // good luck - } - - Log.Debug("Ude: charset '{0}' confidence: '{1}'", cdet.Charset, cdet.Confidence); - Encoding enc = Encoding.GetEncoding(cdet.Charset); - - if(enc == Encoding.UTF8) { - fs.Seek(0, SeekOrigin.Begin); - return (fs.ReadByte() == 0xEF && - fs.ReadByte() == 0xBB && - fs.ReadByte() == 0xBF) ? new UTF8Encoding(true) : new UTF8Encoding(false); - } - - return enc; - } - } - - /// - /// Execute file with arguments - /// - /// - /// - /// Hide process if true - /// Reads from StandardOutput if true - /// How long to wait the execution, in seconds. 0 value - infinitely - protected virtual string run(string file, string args, bool silent, bool stdOut, int timeout = 0) - { - string ret = (new Actions.HProcess(Settings.WPath)).run(file, args, silent, timeout); - return (stdOut)? ret : String.Empty; - } - - /// - /// Gets full path to file with environment PATH. - /// - /// null value if file is not found - protected virtual string findFile(string file) - { - string lfile = location(file); - if(File.Exists(lfile)) { - return lfile; - } - Log.Trace("finding file with environment PATH :: `{0}`({1})", file, lfile); - - string[] exts = System.Environment.GetEnvironmentVariable("PATHEXT").Split(';'); - foreach(string dir in EnvPath) - { - lfile = location(file, dir); - if(File.Exists(lfile) || exts.Any(ext => File.Exists(lfile + ext))) { - Log.Trace("found in: '{0}' :: '{1}'", dir, lfile); - return lfile; - } - } - return null; - } - - /// - /// Location of file for specific path. - /// - protected string location(string file, string path) - { - return Path.Combine(path, file); - } - - /// - /// Location of file for current context. - /// - /// Full path to file - protected string location(string file) - { - return Path.Combine(Settings.WPath, file); - } - - private Encoding encoding(string name) - { - if(String.IsNullOrWhiteSpace(name)) { - throw new InvalidArgumentException("Name of encoding is null or empty."); - } - - if(name.Equals("utf-8", StringComparison.OrdinalIgnoreCase)) { - return new UTF8Encoding(false); // to disable the BOM for Encoding.UTF8 by default - } - - if(name.Equals("utf-8-bom", StringComparison.OrdinalIgnoreCase)) - { - /* The custom name to enable BOM. - Use of a BOM is neither required nor recommended for UTF-8, but may - be encountered in contexts where UTF-8 data is converted from other encoding forms that - use a BOM or where the BOM is used as a UTF-8 signature. - http://www.unicode.org/versions/Unicode5.0.0/ch02.pdf - - So we use this as additional settings. - */ - return new UTF8Encoding(true); - } - - return Encoding.GetEncoding(name); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/FunctionComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/FunctionComponent.cs deleted file mode 100644 index 7e2ad007..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/FunctionComponent.cs +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using net.r_eg.vsSBE.Extensions; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - /// - /// Mixed supported functions - /// - [Component("Func", "Mixed functions.")] - public class FunctionComponent: Component, IComponent - { - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "Func "; } - } - - /// Initialize with loader - public FunctionComponent(IBootloader loader) - : base(loader) - { - - } - - public FunctionComponent() { } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - var point = entryPoint(data.Trim()); - string subtype = point.Key; - string request = point.Value; - - Log.Trace("`{0}`: subtype - `{1}`, request - `{2}`", ToString(), subtype, request); - - IPM pm = new PM(request, msbuild); - switch(subtype) { - case "hash": { - return stHash(pm); - } - } - - throw new SubtypeNotFoundException("Subtype `{0}` is not found", subtype); - } - - /// - /// The hash node. - /// - /// Samples: - /// #[Func hash.MD5("test")] - /// #[Func hash.SHA1("test")] - /// - /// - /// - [Property("hash", "Work with hash.")] - [Method("MD5", - "Calculate hash value with MD5.", - "hash", - "stHash", - new string[] { "data" }, - new string[] { "String for calculating." }, - CValueType.String, - CValueType.String)] - [Method("SHA1", - "Calculate hash value with SHA-1.", - "hash", - "stHash", - new string[] { "data" }, - new string[] { "String for calculating." }, - CValueType.String, - CValueType.String)] - protected string stHash(IPM pm) - { - if(!pm.It(LevelType.Property, "hash")) { - throw new IncorrectNodeException(pm); - } - - ILevel lvlHash = pm.FirstLevel; // level of the hash property - - // hash.MD5("data") - if(pm.FinalEmptyIs(LevelType.Method, "MD5")) { - lvlHash.Is("hash.MD5(string data)", ArgumentType.StringDouble); - return ((string)lvlHash.Args[0].data).MD5Hash(); - } - - // hash.SHA1("data") - if(pm.FinalEmptyIs(LevelType.Method, "SHA1")) { - lvlHash.Is("hash.SHA1(string data)", ArgumentType.StringDouble); - return ((string)lvlHash.Args[0].data).SHA1Hash(); - } - - throw new IncorrectNodeException(pm); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/IComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/IComponent.cs deleted file mode 100644 index 62305f1a..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/IComponent.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - public interface IComponent - { - /// - /// Ability to work with data for component - /// - string Condition { get; } - - /// - /// Using regex engine for property - condition - /// - bool CRegex { get; } - - /// - /// Activation status - /// - bool Enabled { get; set; } - - /// - /// Flag of post-processing with MSBuild core. - /// In general, some components can require immediate processing with evaluation before passing control to next level. - /// This flag allows processing if needed. - /// - bool PostProcessingMSBuild { get; set; } - - /// - /// Should be located before deepening or not - /// - bool BeforeDeepen { get; } - - /// - /// To force post-analysis. - /// - bool PostParse { get; } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - string parse(string data); - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/MSBuildComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/MSBuildComponent.cs deleted file mode 100644 index e2168294..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/MSBuildComponent.cs +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - [Definition("$()", "Advanced evaluation with MSBuild engine.")] - public class MSBuildComponent: Component, IComponent - { - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "$("; } - } - - /// Initialization with loader - public MSBuildComponent(IBootloader loader) - : base(loader) - { - - } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - Match m = Regex.Match(data, @"^\[(\$+)\( # 1 - (?'exp'.+) # MSBuild expression - \)\]$", - RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline); - - if(!m.Success) { - throw new SyntaxIncorrectException("'{0}' Failed `{1}`", ToString(), data); - } - - string type = m.Groups[1].Value; - string exp = m.Groups["exp"].Value; - - return msbuild.parse($"{type}({multiline(exp)})"); - } - - protected virtual string multiline(string cmd) - { - // var hString = new StringHandler(); - return Regex.Replace(cmd, @"[\r\n]\s*", String.Empty); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/NuGet/GetNuTool/Core.cs b/vsSolutionBuildEvent/SBEScripts/Components/NuGet/GetNuTool/Core.cs deleted file mode 100644 index 30d14f0c..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/NuGet/GetNuTool/Core.cs +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2015-2016 Denis Kuzmin (reg) [ entry.reg@gmail.com ] - * - * Distributed under the MIT license - * (see accompanying file LICENSE or a copy at http://opensource.org/licenses/MIT) - * - * Source code from - https://github.com/3F/GetNuTool - * v1.3 - * Modifications: - * - Base path - * - Logger -*/ - -using System; -using System.Collections.Generic; -using System.IO; -using System.IO.Packaging; -using System.Linq; -using System.Net; -using System.Text.RegularExpressions; -using System.Xml.Linq; - -namespace net.r_eg.vsSBE.SBEScripts.Components.NuGet.GetNuTool -{ - public abstract class Core - { - /// - /// Where to look the packages.config files. - /// - protected string ngconfig = ".nuget\\packages.config"; - - /// - /// NuGet server. - /// - protected string ngserver = "https://www.nuget.org/api/v2/package/"; - - /// - /// Common path for all packages. - /// - protected string ngpath = "packages"; - - /// - /// Get path to item with location for current context. - /// - /// - /// - protected abstract string location(string item); - - /// - /// - /// - public string prepareList(string config, string plist) - { - if(!String.IsNullOrEmpty(plist)) { - return plist; - } - - Action> h = delegate(string cfg, Queue list) - { - foreach(var pkg in XDocument.Load(cfg).Descendants("package")) - { - var id = pkg.Attribute("id"); - var version = pkg.Attribute("version"); - var output = pkg.Attribute("output"); - - if(id == null) { - throw new ArgumentException(String.Format("Attribute - 'id' is not found in '{0}'", cfg)); - } - var link = id.Value; - - if(version != null) { - link += "/" + version.Value; - } - - if(output != null) { - list.Enqueue(link + ":" + output.Value); - continue; - } - list.Enqueue(link); - } - }; - - var ret = new Queue(); - foreach(string cfg in config.Split('|')) { - string lcfg = location(cfg); - if(File.Exists(lcfg)) { - h(lcfg, ret); - } - } - - if(ret.Count < 1) { - throw new FileNotFoundException("List of packages is empty. Use packages.config or property like /p:ngpackages=\"...\""); - } - return String.Join(";", ret.ToArray()); - } - - /// - /// - /// - /// - public void downloader(string plist, string url, string defpath, bool debug) - { - // to ignore from package - var ignore = new string[] { "/_rels/", "/package/", "/[Content_Types].xml" }; - - Action dbg = delegate(string s, object p) { - if(debug) { - Log.Debug(s, p); - } - }; - - Action get = delegate(string link, string name, string path) - { - string output = Path.GetFullPath(location(path ?? name)); - if(Directory.Exists(output)) { - Log.Debug("The `{0}` is already exists. /pass -> `{1}`", name, output); - return; - } - Log.Debug("Getting `{0}` ... ", link); - - string temp = Path.Combine(Path.GetTempPath(), name); - using(WebClient wc = new WebClient()) { - wc.DownloadFile(url + link, temp); - } - - Log.Debug("Extracting into `{0}`", output); - using(Package package = ZipPackage.Open(temp, FileMode.Open, FileAccess.Read)) - { - foreach(PackagePart part in package.GetParts()) - { - var uri = Uri.UnescapeDataString(part.Uri.OriginalString); - if(ignore.Any(x => uri.StartsWith(x, StringComparison.Ordinal))) { - continue; - } - - var dest = Path.Combine(output, uri.TrimStart('/')); - dbg("-> `{0}`", uri); - - var dir = Path.GetDirectoryName(dest); - if(!Directory.Exists(dir)) { - Directory.CreateDirectory(dir); - } - - using(Stream source = part.GetStream(FileMode.Open, FileAccess.Read)) - using(FileStream target = File.OpenWrite(dest)) { - source.CopyTo(target); - } - } - } - dbg("Done.{0}", System.Environment.NewLine); - }; - - //Format: id/version[:path];id2/version[:path];... - - foreach(var package in plist.Split(';')) - { - var ident = package.Split(':'); - var link = ident[0]; - var path = (ident.Length > 1) ? ident[1] : null; - var name = link.Replace('/', '.'); - - if(!String.IsNullOrEmpty(defpath)) { - path = Path.Combine(defpath, path ?? name); - } - get(link, name, path); - } - } - - /// - /// - /// - public void packing(string dir, string dout, bool debug) - { - const string EXT_NUSPEC = ".nuspec"; - const string EXT_NUPKG = ".nupkg"; - const string TAG_META = "metadata"; - const string DEF_CONTENT_TYPE = "application/octet"; //System.Net.Mime.MediaTypeNames.Application.Octet - const string MANIFEST_URL = "http://schemas.microsoft.com/packaging/2010/07/manifest"; - - // Tags - const string ID = "id"; - const string VER = "version"; - - Action dbg = delegate(string s, object p) { - if(debug) { - Log.Debug(s, p); - } - }; - - // Get metadata - - var nuspec = Directory.GetFiles(dir, "*" + EXT_NUSPEC, SearchOption.TopDirectoryOnly).FirstOrDefault(); - if(nuspec == null) { - throw new FileNotFoundException(String.Format("The {0} file is not found in `{1}`", EXT_NUSPEC, dir)); - } - Log.Debug("Found {0}: `{1}`", EXT_NUSPEC, nuspec); - - var root = XDocument.Load(nuspec).Root.Elements().FirstOrDefault(x => x.Name.LocalName == TAG_META); - if(root == null) { - throw new FileNotFoundException(String.Format("The `{0}` not contains {1}.", nuspec, TAG_META)); - } - - var metadata = new Dictionary(); - foreach(var tag in root.Elements()) { - metadata[tag.Name.LocalName.ToLower()] = tag.Value; - } - - // Validate data - rules of nuget core - - if(metadata[ID].Length > 100 || !Regex.IsMatch(metadata[ID], - @"^\w+([_.-]\w+)*$", - RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture)) - { - throw new FormatException(String.Format("The data format of `{0}` is not correct.", ID)); - } - new System.Version(metadata[VER]); // check with System.Version - - // Format package - - var ignore = new string[] { // to ignore from package - Path.Combine(dir, "_rels"), - Path.Combine(dir, "package"), - Path.Combine(dir, "[Content_Types].xml") }; - - string pout = String.Format("{0}.{1}{2}", metadata[ID], metadata[VER], EXT_NUPKG); - if(!String.IsNullOrWhiteSpace(dout)) { - if(!Directory.Exists(dout)) { - Directory.CreateDirectory(dout); - } - pout = Path.Combine(dout, pout); - } - - Log.Debug("Started packing `{0}` ...", pout); - using(Package package = Package.Open(pout, FileMode.Create)) - { - // manifest relationship - - Uri manifestUri = new Uri(String.Format("/{0}{1}", metadata[ID], EXT_NUSPEC), UriKind.Relative); - package.CreateRelationship(manifestUri, TargetMode.Internal, MANIFEST_URL); - - // content - - foreach(var file in Directory.GetFiles(dir, "*.*", SearchOption.AllDirectories)) - { - if(ignore.Any(x => file.StartsWith(x, StringComparison.Ordinal))) { - continue; - } - - string pUri; - if(file.StartsWith(dir, StringComparison.OrdinalIgnoreCase)) { - pUri = file.Substring(dir.Length).TrimStart(Path.DirectorySeparatorChar); - } - else { - pUri = file; - } - dbg("-> `{0}`", pUri); - - // to protect path without separators - var escaped = String.Join("/", pUri.Split('\\', '/').Select(p => Uri.EscapeDataString(p))); - Uri uri = PackUriHelper.CreatePartUri(new Uri(escaped, UriKind.Relative)); - - PackagePart part = package.CreatePart(uri, DEF_CONTENT_TYPE, CompressionOption.Maximum); - - using (Stream tstream = part.GetStream()) - using(FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read)) { - fileStream.CopyTo(tstream); - } - } - - // metadata for package - - Func getmeta = delegate(string key) { - return (metadata.ContainsKey(key))? metadata[key] : ""; - }; - - package.PackageProperties.Creator = getmeta("authors"); - package.PackageProperties.Description = getmeta("description"); - package.PackageProperties.Identifier = metadata[ID]; - package.PackageProperties.Version = metadata[VER]; - package.PackageProperties.Keywords = getmeta("tags"); - package.PackageProperties.Title = getmeta("title"); - package.PackageProperties.LastModifiedBy = String.Format("{0} v{1} - GetNuTool Core", Settings.APP_NAME, Version.numberWithRevString); - } - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/NuGet/GetNuTool/GNT.cs b/vsSolutionBuildEvent/SBEScripts/Components/NuGet/GetNuTool/GNT.cs deleted file mode 100644 index ae45725f..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/NuGet/GetNuTool/GNT.cs +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.SBEScripts.Components.NuGet.GetNuTool -{ - public class GNT: Core - { - /// - /// Target by default - /// - public const string DEF_TARGET = "get"; - - /// - /// Debug mode for core - /// - protected bool debug; - - /// - /// Raw command as for original GetNuTool - /// https://github.com/3F/GetNuTool - /// - /// - public void raw(string data) - { - Match mtarget = Regex.Match(data, @"\/t(?:arget)?:(\w+)"); - string target = (!mtarget.Success)? DEF_TARGET : mtarget.Groups[1].Value; - - // arguments for target - var props = Regex.Matches(data, @"\/p(?:roperty)? - :(?'name'\w+) - \s*=\s* - (?: - ""(?'sval'.+?)"" - (?= - (?: - \s+\/[a-zA-Z]+?: - | - \s*$ - ) - ) - | - (?'val'[^\s]+) - )", - RegexOptions.IgnorePatternWhitespace); - - var prop = new Dictionary(); - foreach(Match p in props) { - prop[p.Groups["name"].Value] = p.Groups[p.Groups["val"].Success ? "val" : "sval"].Value; - } - - Func _ = delegate (string key) { - return prop.ContainsKey(key) ? prop[key] : null; - }; - - debug = Value.toBoolean(_("debug") ?? "false"); - - switch(target) { - case "get": { - getCommand(_("ngpackages"), _("ngconfig"), _("ngpath"), _("ngserver")); - return; - } - case "pack": { - packCommand(_("ngin"), _("ngout")); - return; - } - } - - throw new OperandNotFoundException("`{0}` Can't find command - `{1}` :: raw({2})", ToString(), target, data); - } - - /// - /// - /// - /// - public void getCommand(string packages, string config = null, string path = null, string server = null) - { - string list = prepareList(config ?? String.Empty, packages ?? String.Empty); - downloader(list, server ?? ngserver, location(path ?? ngpath), debug); - } - - /// - /// - public void packCommand(string dir, string dout) - { - packing(location(dir), location(dout), debug); - } - - /// - /// Gets path from working directory to selected item. - /// - /// - /// - protected override string location(string item) - { - return Path.Combine(Settings.WPath, item ?? String.Empty); - } - } -} \ No newline at end of file diff --git a/vsSolutionBuildEvent/SBEScripts/Components/NuGetComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/NuGetComponent.cs deleted file mode 100644 index 1c28367c..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/NuGetComponent.cs +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts.Components.NuGet.GetNuTool; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - [Component("NuGet", "Support of NuGet packages")] - public class NuGetComponent: Component, IComponent - { - /// - /// GetNuTool core - /// - protected GNT gnt = new GNT(); - - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "NuGet "; } - } - - /// Initialize with loader - public NuGetComponent(IBootloader loader) - : base(loader) - { - - } - - public NuGetComponent() { } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - var point = entryPoint(data); - string subtype = point.Key; - string request = point.Value; - - Log.Trace("`{0}`: subtype - `{1}`, request - `{2}`", ToString(), subtype, request); - - IPM pm = new PM(request, msbuild); - switch(subtype) { - case "gnt": { - return stGNT(pm); - } - } - - throw new SubtypeNotFoundException("Subtype `{0}` is not found", subtype); - } - - /// - /// Work with gnt node. /GetNuTool - /// Sample: #[NuGet gnt] - /// - /// - /// - [Property("gnt", "GetNuTool logic - github.com/3F/GetNuTool")] - protected string stGNT(IPM pm) - { - if(!pm.Is(LevelType.Property, "gnt")) { - throw new IncorrectNodeException(pm); - } - ILevel level = pm.Levels[1]; // level of the gnt property - - if(pm.FinalEmptyIs(1, LevelType.Method, "raw")) { - return rawMethod(level, pm); - } - - // TODO: +gnt.get(object list [, string path [, string server]]) + config files - // +gnt.pack(string nuspec [, string path]) - - throw new IncorrectNodeException(pm, 1); - } - - /// - /// Prepares signatures: - /// gnt.raw(string command) - /// - /// - /// - /// - [Method("raw", - "Push raw command to GetNuTool core.", - "gnt", - "stGNT", - new string[] { "command" }, - new string[] { "Command to execute" }, - CValueType.Void, - CValueType.String)] - protected string rawMethod(ILevel level, IPM pm) - { - if(level.Is(ArgumentType.StringDouble)) { - gnt.raw((string)level.Args[0].data); - return Value.Empty; - } - - throw new InvalidArgumentException("Incorrect arguments to `gnt.raw(string command)`"); - } - } -} \ No newline at end of file diff --git a/vsSolutionBuildEvent/SBEScripts/Components/OWPComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/OWPComponent.cs deleted file mode 100644 index c2817d6c..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/OWPComponent.cs +++ /dev/null @@ -1,481 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.Receiver.Output; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; -using OWPIdent = net.r_eg.vsSBE.Receiver.Output.Ident; -using OWPItems = net.r_eg.vsSBE.Receiver.Output.Items; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - [Component("OWP", "For work with OWP (Output Window Pane)")] - public class OWPComponent: Component, IComponent, ILogData - { - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "OWP "; } - } - - /// - /// atomic unit - /// - protected struct LogData - { - public string Message { get; set; } - public string Level { get; set; } - } - protected LogData logcopy; - - /// - /// OutputWindowPane - /// - protected virtual IOW OWP - { - get { - if(env.OutputWindowPane == null) { - throw new NotSupportedException("The OW pane is not available for current environment."); - } - return env.OutputWindowPane; - } - } - - /// Used environment - public OWPComponent(IEnvironment env) - : base(env) - { - - } - - /// - /// Updating copies of the log data for work with event of logging - /// - /// - /// - public void updateLogData(string message, string level) - { - logcopy = new LogData() { - Message = message, - Level = level - }; - } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - var point = entryPoint(data, RegexOptions.Singleline); - string subtype = point.Key; - string request = point.Value; - - Log.Trace("`{0}`: subtype - `{1}`, request - `{2}`", ToString(), subtype, request); - - switch(subtype) { - case "out": { - return stOut(new PM(request)); - } - case "log": { - return stLog(new PM(request)); - } - case "item": { - return stItem(new PM(request)); - } - } - throw new SubtypeNotFoundException("Subtype `{0}` is not found", subtype); - } - - /// - /// For work with events of logging. - /// `log.Message` - /// `log.Level` - /// - /// - /// - [Property("log", "Provides data from events of logging.")] - [Property("Message", "Current message from log.", "log", "stLog", CValueType.String)] - [Property("Level", "The Level of current Message.", "log", "stLog", CValueType.String)] - protected string stLog(IPM pm) - { - if(pm.It(LevelType.Property, "log")) - { - if(pm.It(LevelType.Property, "Message")) { - return Value.from(logcopy.Message); - } - - if(pm.It(LevelType.Property, "Level")) { - return Value.from(logcopy.Level); - } - - throw new IncorrectNodeException(pm); - } - - throw new IncorrectNodeException(pm); - } - - /// - /// Access to OW items. - /// `item("name")` - /// - /// - /// - [Method( - "item", - "Access to item of the Output window by name.", - new string[] { "name" }, - new string[] { "Name of item" }, - CValueType.Void, - CValueType.String - )] - protected string stItem(IPM pm) - { - if(!pm.Is(LevelType.Method, "item")) { - throw new IncorrectNodeException(pm); - } - ILevel level = pm.FirstLevel; // level of the item() method - - if(!level.Is(ArgumentType.StringDouble)) { - throw new ArgumentPMException(level, "item(string name)"); - } - string name = (string)level.Args[0].data; - - if(String.IsNullOrWhiteSpace(name) - /*|| name.Trim().Equals(Settings.OWP_ITEM_VSSBE, StringComparison.OrdinalIgnoreCase)*/) - { - throw new NotSupportedOperationException("The OW pane '{0}' is not available for current operation.", name); - } - - pm.pinTo(1); - switch(pm.FirstLevel.Data) - { - case "write": { - return stItemWrite(name, false, pm); - } - case "writeLine": { - return stItemWrite(name, true, pm); - } - case "delete": { - return stItemDelete(name, pm); - } - case "clear": { - return stItemClear(name, pm); - } - case "activate": { - return stItemActivate(name, pm); - } - } - - throw new IncorrectNodeException(pm); - } - - /// - /// To send data into OutputWindowPane window. - /// `item("name").write(true): content` - /// `item("name").writeLine(true): content` - /// - /// - /// Flag of new line symbol - /// - /// - [Method( - "write", - "Writes data into selected pane.", - "item", - "stItem", - new string[] { "force", "In" }, - new string[] { "Creates selected item if it does not exist for true value.", "Content" }, - CValueType.Void, - CValueType.Boolean, CValueType.Input - )] - [Method( - "writeLine", - "Writes data with the newline char into selected pane.", - "item", - "stItem", - new string[] { "force", "In" }, - new string[] { "Creates selected item if it does not exist for true value.", "Content" }, - CValueType.Void, - CValueType.Boolean, CValueType.Input - )] - protected string stItemWrite(string name, bool newline, IPM pm) - { - if(!pm.IsMethodWithArgs("write", ArgumentType.Boolean) - && !pm.IsMethodWithArgs("writeLine", ArgumentType.Boolean)) - { - throw new IncorrectNodeException(pm); - } - bool createIfNotExist = (bool)pm.FirstLevel.Args[0].data; - - if(pm.Levels[1].Type != LevelType.RightOperandColon) { - throw new IncorrectNodeException(pm); - } - - string content = pm.Levels[1].Data; - - EnvDTE.OutputWindowPane pane; - if(!createIfNotExist) - { - try { - pane = OWP.getByName(name, false); - } - catch(ArgumentException) { - throw new NotFoundException("The item '{0}' does not exist. Use 'force' flag for automatic creation if needed.", name); - } - } - else { - pane = OWP.getByName(name, true); - } - - if(newline) { - content += System.Environment.NewLine; - } - pane.OutputString(content); - - return Value.Empty; - } - - /// - /// Removes selected pane. - /// `item("name").delete = true` - /// - /// Name of item - /// - /// - [Property( - "delete", - "Removes pane. Returns false value if item does not exist, otherwise true as a successfully deleted.", - "item", - "stItem", - CValueType.Boolean, - CValueType.Boolean - )] - protected string stItemDelete(string name, IPM pm) - { - if(!pm.It(LevelType.Property, "delete") || !pm.IsRight(LevelType.RightOperandStd)) { - throw new IncorrectNodeException(pm); - } - - if(!Value.toBoolean(pm.FirstLevel.Data)) { -#if DEBUG - Log.Trace("skip removing '{0}'", name); -#endif - return Value.from(false); - } - - Log.Debug("removing the item '{0}'", name); - try { - OWP.deleteByName(name); - return Value.from(true); - } - catch(ArgumentException) { - Log.Debug("Incorrect name of pane item `{0}`", name); - } - - return Value.from(false); - } - - /// - /// To clear contents from pane. - /// `item("name").clear = true` - /// - /// - /// - /// - [Property( - "clear", - "To clear contents from OW pane. Returns false value if item does not exist, otherwise true as a successfully cleared.", - "item", - "stItem", - CValueType.Boolean, - CValueType.Boolean - )] - protected string stItemClear(string name, IPM pm) - { - if(!pm.It(LevelType.Property, "clear") || !pm.IsRight(LevelType.RightOperandStd)) { - throw new IncorrectNodeException(pm); - } - - if(!Value.toBoolean(pm.FirstLevel.Data)) { -#if DEBUG - Log.Trace("skip clearing '{0}'", name); -#endif - return Value.from(false); - } - - Log.Debug("Clearing the item '{0}'", name); - try { - OWP.getByName(name, false).Clear(); - return Value.from(true); - } - catch(ArgumentException) { - Log.Debug("Incorrect name of pane item `{0}`", name); - } - - return Value.from(false); - } - - /// - /// Activate item by name. - /// `item("name").activate = true` - /// - /// - /// - /// - [Property( - "activate", - "To activate (display) OW pane by item name.", - "item", - "stItem", - CValueType.Boolean, - CValueType.Boolean - )] - protected string stItemActivate(string name, IPM pm) - { - if(!pm.It(LevelType.Property, "activate") || !pm.IsRight(LevelType.RightOperandStd)) { - throw new IncorrectNodeException(pm); - } - - if(!Value.toBoolean(pm.FirstLevel.Data)) { -#if DEBUG - Log.Trace("skip activation of pane '{0}'", name); -#endif - return Value.from(false); - } - - Log.Debug("Activation the item '{0}'", name); - try { - OWP.getByName(name, false).Activate(); - return Value.from(true); - } - catch(ArgumentException) { - Log.Debug("Incorrect name of pane item `{0}`", name); - } - - return Value.from(false); - } - - /// - /// Gets data from the output pane. - /// - /// - /// - [Method( - "out", - "Streaming of getting the mixed data from selected pane. Returns: partial raw data.", - new string[] { "name" }, - new string[] { "Name of pane" }, - CValueType.String, - CValueType.String - )] - [Method( - "out", - "Streaming of getting the mixed data from selected pane. Returns: partial raw data.", - new string[] { "ident", "isGuid" }, - new string[] { "Identifier of pane", "Use Guid as identifier or as name of item" }, - CValueType.String, - CValueType.String, CValueType.Boolean - )] - [Property("out", "Alias for: out(\"Build\").", CValueType.String)] - [Property("All", "Get raw data if exists.", "out", "stOut", CValueType.String)] - [Property("Warnings", "For work with warnings from received data. Also used as short alias for: Warnings.Raw", "out", "stOut", CValueType.String)] - [Property("Raw", "Return the partial raw data with warning/s if an exists.", "Warnings", "stOut", CValueType.String)] - [Property("Count", "Count of warnings from data", "Warnings", "stOut", CValueType.Integer)] - [Property("Codes", "List of warnings from data as C4702,4505, ...", "Warnings", "stOut", CValueType.List)] - [Property("Errors", "For work with errors from received data. Also used as short alias for: Errors.Raw:", "out", "stOut", CValueType.String)] - [Property("Raw", "Return the partial raw data with errors if an exists", "Errors", "stOut", CValueType.String)] - [Property("Count", "Count of errors from data", "Errors", "stOut", CValueType.Integer)] - [Property("Codes", "List of errors from data as C4702,4505, ...", "Errors", "stOut", CValueType.List)] - protected string stOut(IPM pm) - { - if(!pm.Is(LevelType.Property, "out") && !pm.Is(LevelType.Method, "out")) { - throw new IncorrectNodeException(pm); - } - - string item = Settings._.DefaultOWPItem; // by default for all - bool isGuid = false; - - if(pm.Is(LevelType.Method, "out")) - { - ILevel lvlOut = pm.FirstLevel; - if(!lvlOut.Is(ArgumentType.StringDouble) - && !lvlOut.Is(ArgumentType.StringDouble, ArgumentType.Boolean)) - { - throw new InvalidArgumentException("Incorrect arguments to `out(string ident [, boolean isGuid])`"); - } - Argument[] args = lvlOut.Args; - - item = (string)args[0].data; - isGuid = (args.Length == 2)? (bool)args[1].data : false; // optional isGuid param - } - - Log.Trace("stOut: out = item('{0}'), isGuid('{1}')", item, isGuid); - - IItemEW ew = OWPItems._.getEW((isGuid)? new OWPIdent() { guid = item } : new OWPIdent() { item = item }); - string raw = StringHandler.escapeQuotes(ew.Raw); - - // #[OWP out.All] / #[OWP out] / #[OWP out("Build").All] / #[OWP out("Build")] ... - if(pm.FinalEmptyIs(1, LevelType.Property, "All") || pm.FinalEmptyIs(1, LevelType.RightOperandEmpty)) { - return raw; - } - - // #[OWP out.Warnings.Count] ... - if(pm.Is(1, LevelType.Property, "Warnings") && pm.FinalEmptyIs(2, LevelType.Property, "Count")) { - return Value.from(ew.WarningsCount); - } - - // #[OWP out.Warnings.Codes] ... - if(pm.Is(1, LevelType.Property, "Warnings") && pm.FinalEmptyIs(2, LevelType.Property, "Codes")) { - return Value.from(ew.Warnings); - } - - // #[OWP out.Warnings.Raw] / #[OWP out.Warnings] ... - if((pm.Is(1, LevelType.Property, "Warnings") && pm.FinalEmptyIs(2, LevelType.Property, "Raw")) - || pm.FinalEmptyIs(1, LevelType.Property, "Warnings")) - { - return (ew.IsWarnings)? raw : Value.Empty; - } - - // #[OWP out.Errors.Count] ... - if(pm.Is(1, LevelType.Property, "Errors") && pm.FinalEmptyIs(2, LevelType.Property, "Count")) { - return Value.from(ew.ErrorsCount); - } - - // #[OWP out.Errors.Codes] ... - if(pm.Is(1, LevelType.Property, "Errors") && pm.FinalEmptyIs(2, LevelType.Property, "Codes")) { - return Value.from(ew.Errors); - } - - // #[OWP out.Errors.Raw] / #[OWP out.Errors] ... - if((pm.Is(1, LevelType.Property, "Errors") && pm.FinalEmptyIs(2, LevelType.Property, "Raw")) - || pm.FinalEmptyIs(1, LevelType.Property, "Errors")) - { - return (ew.IsErrors)? raw : Value.Empty; - } - - throw new IncorrectNodeException(pm, 1); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/SevenZipComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/SevenZipComponent.cs deleted file mode 100644 index d36c7c1e..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/SevenZipComponent.cs +++ /dev/null @@ -1,747 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.Extensions; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; -using SevenZip; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - /// - /// Support of archives via 7-Zip engine - /// - [Component("7z", "7-Zip.\nFile archiver with high compression ratio.\nwww.7-zip.org")] - public class SevenZipComponent: Component, IComponent - { - /// - /// Name of library with full 7-Zip engine for work with all available formats. - /// - public const string LIB_FULL = "7z.dll"; - - /// - /// Name of library with compact version of 7-Zip engine for 7z archives. - /// - public const string LIB_ZA = "7za.dll"; - - /// - /// Name of library with compact version of 7-Zip engine for extracting from 7z archives. - /// - public const string LIB_ZXA = "7zxa.dll"; - - /// - /// Is ready to work with library ? - /// - private bool isReady = false; - - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "7z "; } - } - - /// Initialize with loader - public SevenZipComponent(IBootloader loader) - : base(loader) - { - initLib(); - } - - public SevenZipComponent() - { - initLib(); - } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - if(!isReady) { - throw new ComponentException("`{0}` is not ready for work with 7-zip engine. Details in log.", ToString()); - } - - var point = entryPoint(data); - string subtype = point.Key; - string request = point.Value; - - Log.Trace("`{0}`: subtype - `{1}`, request - `{2}`", ToString(), subtype, request); - - IPM pm = new PM(request, msbuild); - switch(subtype) { - case "pack": { - return stPack(pm); - } - case "unpack": { - return stUnpack(pm); - } - case "check": { - return stCheck(pm); - } - } - - throw new SubtypeNotFoundException("Subtype `{0}` is not found", subtype); - } - - protected void initLib() - { - string cPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location).PathFormat(); - Log.Debug($"7z: path '{cPath}'"); - - try { - SevenZipBase.SetLibraryPath(Path.Combine(cPath, LIB_FULL)); - isReady = true; - } - catch(Exception ex) { - Log.Error("Found problem with library {0} ({1}): `{2}`", LIB_FULL, cPath, ex.Message); - } - } - - /// - /// Work with packing node. - /// Sample: #[7z pack] - /// - /// - /// - [Property("pack", "Packing with 7-zip engine.")] - protected string stPack(IPM pm) - { - if(!pm.It(LevelType.Property, "pack")) { - throw new IncorrectNodeException(pm); - } - ILevel level = pm.FirstLevel; // level of the pack property - - if(pm.FinalEmptyIs(LevelType.Method, "files")) { - return packFiles(level, pm); - } - - if(pm.FinalEmptyIs(LevelType.Method, "directory")) { - return packDirectory(level, pm); - } - - throw new IncorrectNodeException(pm); - } - - /// - /// Prepares signatures: - /// pack.files({"f1", "f2", "*.dll"}, "output" [, format, method, level]) - /// pack.files({"f1", "f2", "*.dll"}, "output", {" f3.dll"} [, format, method, level]) - /// - /// - /// - /// - protected string packFiles(ILevel level, IPM pm) - { - if(level.Is(ArgumentType.Object, ArgumentType.StringDouble)) { - return stPackFiles((Argument[])level.Args[0].data, (string)level.Args[1].data, pm.pinTo(1)); - } - - if(level.Is(ArgumentType.Object, ArgumentType.StringDouble, ArgumentType.EnumOrConst, ArgumentType.EnumOrConst, ArgumentType.Integer)) - { - return stPackFiles( - (Argument[])level.Args[0].data, - (string)level.Args[1].data, - (OutArchiveFormat)Enum.Parse(typeof(OutArchiveFormat), (string)level.Args[2].data), - (CompressionMethod)Enum.Parse(typeof(CompressionMethod), (string)level.Args[3].data), - (CompressionLevel)(int)level.Args[4].data, - pm.pinTo(1)); - } - - if(level.Is(ArgumentType.Object, ArgumentType.StringDouble, ArgumentType.Object)) { - return stPackFiles((Argument[])level.Args[0].data, (string)level.Args[1].data, (Argument[])level.Args[2].data, pm.pinTo(1)); - } - - if(level.Is(ArgumentType.Object, ArgumentType.StringDouble, ArgumentType.Object, ArgumentType.EnumOrConst, ArgumentType.EnumOrConst, ArgumentType.Integer)) - { - return stPackFiles( - (Argument[])level.Args[0].data, - (string)level.Args[1].data, - (Argument[])level.Args[2].data, - (OutArchiveFormat)Enum.Parse(typeof(OutArchiveFormat), (string)level.Args[3].data), - (CompressionMethod)Enum.Parse(typeof(CompressionMethod), (string)level.Args[4].data), - (CompressionLevel)(int)level.Args[5].data, - pm.pinTo(1)); - } - - throw new ArgumentPMException(level, "pack.files(object files, string output [, object except][, enum format, enum method, integer level])"); - } - - /// - /// Packing files for signature: - /// `pack.files(object files, string output)` - /// - /// Input files. - /// Output archive. - /// - /// - protected string stPackFiles(Argument[] files, string name, IPM pm) - { - return stPackFiles(files, name, null, pm); - } - - /// - /// Packing files for signature: - /// `pack.files(object files, string output, object except)` - /// - /// Input files. - /// Output archive. - /// List of files to exclude from input list. - /// - /// - protected string stPackFiles(Argument[] files, string name, Argument[] except, IPM pm) - { - return stPackFiles(files, name, except, OutArchiveFormat.Zip, CompressionMethod.Deflate, CompressionLevel.Normal, pm); - } - - /// - /// Packing files for signature: - /// `pack.files(object files, string output, enum format, enum method, integer level)` - /// - /// Input files. - /// Output archive. - /// - /// - /// - /// - /// - protected string stPackFiles(Argument[] files, string name, OutArchiveFormat type, CompressionMethod method, CompressionLevel rate, IPM pm) - { - return stPackFiles(files, name, null, type, method, rate, pm); - } - - /// - /// Packing files for signature: - /// `pack.files(object files, string output, object except, enum format, enum method, integer level)` - /// - /// Input files. - /// Output archive. - /// List of files to exclude from input list. - /// - /// - /// - /// - /// - [Method("files", - "To compress selected files with default settings.", - "pack", - "stPack", - new string[] { "files", "output" }, - new string[] { "List of files as {\"f1\", \"path\\*.dll\", ..}", "Archive name" }, - CValueType.Void, - CValueType.Object, CValueType.String)] - [Method("files", - "To compress selected files with default settings.", - "pack", - "stPack", - new string[] { "files", "output", "except" }, - new string[] { - "List of files as {\"f1\", \"path\\*.dll\", ..}", - "Archive name", - "List of files to exclude from input list" - }, - CValueType.Void, - CValueType.Object, CValueType.String, CValueType.Object)] - [Method("files", - "To compress selected files with custom settings.", - "pack", - "stPack", - new string[] { "files", "output", "format", "method", "level" }, - new string[] { - "List of files as {\"f1\", \"path\\*.dll\", ..}", - "Archive name", - "Type of archive: SevenZip, Zip, GZip, BZip2, Tar, XZ", - "Compression method: Copy, Deflate, Deflate64, BZip2, Lzma, Lzma2, Ppmd", - "Compression level: 0 (None) to 5 (Maximum)" - }, - CValueType.Void, - CValueType.Object, CValueType.String, CValueType.Enum, CValueType.Enum, CValueType.UInteger)] - [Method("files", - "To compress selected files with custom settings.", - "pack", - "stPack", - new string[] { "files", "output", "except", "format", "method", "level" }, - new string[] { - "List of files as {\"f1\", \"path\\*.dll\", ..}", - "Archive name", - "List of files to exclude from input list", - "Type of archive: SevenZip, Zip, GZip, BZip2, Tar, XZ", - "Compression method: Copy, Deflate, Deflate64, BZip2, Lzma, Lzma2, Ppmd", - "Compression level: 0 (None) to 5 (Maximum)" - }, - CValueType.Void, - CValueType.Object, CValueType.String, CValueType.Object, CValueType.Enum, CValueType.Enum, CValueType.UInteger)] - protected string stPackFiles(Argument[] files, string name, Argument[] except, OutArchiveFormat type, CompressionMethod method, CompressionLevel rate, IPM pm) - { - Log.Trace("stPackFiles: `{0}` : type({1}), method({2}), level({3})", name, type, method, rate); - - if(String.IsNullOrWhiteSpace(name)) { - throw new InvalidArgumentException("The output name of archive is empty."); - } - - if(files.Length < 1) { - throw new InvalidArgumentException("List of files is empty."); - } - - if(files.Any(p => p.type != ArgumentType.StringDouble)) { - throw new InvalidArgumentException("Incorrect data from input files. Define as {\"f1\", \"f2\", ...}"); - } - - if(except != null && except.Any(p => p.type != ArgumentType.StringDouble)) { - throw new InvalidArgumentException("Incorrect data from the 'except' argument. Define as {\"f1\", \"f2\", ...}"); - } - - // additional checking of input files. - // The SevenZipSharp creates directories if input file is not exist o_O - string[] input = files.Select((f, i) => pathToFile((string)f.data, i)).ToArray().ExtractFiles(); -#if DEBUG - Log.Trace("stPackFiles: Found files `{0}`", String.Join(", ", input)); -#endif - if(except != null) { - input = input.Except(except - .Where(f => !String.IsNullOrWhiteSpace((string)f.data)) - .Select(f => location((string)f.data)) - .ToArray() - .ExtractFiles() - ).ToArray(); - } - - if(input.Length < 1) { - throw new InvalidArgumentException("The input files was not found. Check your mask and the exception list if used."); - } - - SevenZipCompressor zip = new SevenZipCompressor() - { - ArchiveFormat = type, - CompressionMethod = method, - CompressionLevel = rate, - CompressionMode = CompressionMode.Create, - FastCompression = true, // to disable some events inside SevenZip - DirectoryStructure = true, - }; - - compressFiles(zip, location(name), input); - return Value.Empty; - } - - /// Compressor. - /// Archive name. - /// Input files. - protected virtual void compressFiles(SevenZipCompressor zip, string name, params string[] input) - { - zip.CompressFiles(name, input); // -_- - } - - /// - /// Prepares signatures: - /// pack.directory(string dir, string output [, enum format, enum method, integer level]) - /// - /// - /// - /// - protected string packDirectory(ILevel level, IPM pm) - { - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble)) { - return stPackDirectory((string)level.Args[0].data, (string)level.Args[1].data, pm.pinTo(1)); - } - - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.EnumOrConst, ArgumentType.EnumOrConst, ArgumentType.Integer)) - { - return stPackDirectory( - (string)level.Args[0].data, - (string)level.Args[1].data, - (OutArchiveFormat)Enum.Parse(typeof(OutArchiveFormat), (string)level.Args[2].data), - (CompressionMethod)Enum.Parse(typeof(CompressionMethod), (string)level.Args[3].data), - (CompressionLevel)(int)level.Args[4].data, - pm.pinTo(1)); - } - - throw new ArgumentPMException(level, "pack.directory(string dir, string output [, enum format, enum method, integer level])"); - } - - /// - /// Packing directory for signature: - /// pack.directory(string dir, string output) - /// - /// Input directory. - /// Output archive. - /// - /// - protected string stPackDirectory(string dir, string name, IPM pm) - { - return stPackDirectory(dir, name, OutArchiveFormat.Zip, CompressionMethod.Deflate, CompressionLevel.Normal, pm); - } - - /// - /// Packing directory for signature: - /// pack.directory(string dir, string output, enum format, enum method, integer level) - /// - /// Input directory. - /// Output archive. - /// - /// - /// - /// - /// - [Method("directory", - "To compress selected directory with default settings.", - "pack", - "stPack", - new string[] { "path", "output" }, - new string[] { "Path to directory for packing", "Archive name" }, - CValueType.Void, - CValueType.String, CValueType.String)] - [Method("directory", - "To compress selected directory with custom settings.", - "pack", - "stPack", - new string[] { "path", "output", "format", "method", "level" }, - new string[] { - "Path to directory for packing", - "Archive name", - "Type of archive: SevenZip, Zip, GZip, BZip2, Tar, XZ", - "Compression method: Copy, Deflate, Deflate64, BZip2, Lzma, Lzma2, Ppmd", - "Compression level: 0 (None) to 5 (Maximum)" - }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.Enum, CValueType.Enum, CValueType.UInteger)] - protected string stPackDirectory(string dir, string name, OutArchiveFormat type, CompressionMethod method, CompressionLevel rate, IPM pm) - { - Log.Trace("stPackDirectory: `{0}` -> `{1}` : type({2}), method({3}), level({4})", dir, name, type, method, rate); - - if(String.IsNullOrWhiteSpace(dir)) { - throw new InvalidArgumentException("The path to directory is empty."); - } - - if(String.IsNullOrWhiteSpace(name)) { - throw new InvalidArgumentException("The output name of archive is empty."); - } - - string fullpath = location(dir); - - // additional checking of input directory. - // The SevenZipSharp creates empty file of archive even if the input directory is not exist o_O - if(!Directory.Exists(fullpath)) { - throw new NotFoundException("Directory `{0}` is not found. Looked as `{1}`", dir, fullpath); - } - - SevenZipCompressor zip = new SevenZipCompressor() - { - ArchiveFormat = type, - CompressionMethod = method, - CompressionLevel = rate, - CompressionMode = CompressionMode.Create, - FastCompression = true, // to disable some events inside SevenZip - IncludeEmptyDirectories = true - }; - - compressDirectory(zip, fullpath, location(name)); - return Value.Empty; - } - - /// Compressor. - /// Input directory. - /// Archive name. - protected virtual void compressDirectory(SevenZipCompressor zip, string path, string name) - { - zip.CompressDirectory(path, name); - } - - /// - /// Work with unpacking node. - /// Sample: #[7z unpack] - /// - /// - /// - [Method("unpack", - "Extract archive data into same directory.", - new string[] { "file" }, - new string[] { "Archive for unpacking" }, - CValueType.Void, - CValueType.String)] - [Method("unpack", - "Extract archive data into selected directory.", - new string[] { "file", "output" }, - new string[] { "Archive for unpacking", "Output path to unpacking archive data" }, - CValueType.Void, - CValueType.String, CValueType.String)] - [Method("unpack", - "Extract data from protected archive into selected directory.", - new string[] { "file", "output", "pwd" }, - new string[] { "Archive for unpacking", "Output path to unpacking archive data", "Password of archive" }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.String)] - [Method("unpack", - "Extract archive data into selected directory and delete it after extraction if needed.", - new string[] { "file", "output", "delete" }, - new string[] { "Archive for unpacking", "Output path to unpacking archive data", "To delete archive after extraction if true" }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.Boolean)] - [Method("unpack", - "Extract data from protected archive into selected directory and delete it after extraction if needed.", - new string[] { "file", "output", "delete", "pwd" }, - new string[] { "Archive for unpacking", "Output path to unpacking archive data", "To delete archive after extraction if true", "Password of archive" }, - CValueType.Void, - CValueType.String, CValueType.String, CValueType.Boolean, CValueType.String)] - [Method("unpack", - "Extract archive data into same directory and delete it after extraction if needed.", - new string[] { "file", "delete" }, - new string[] { "Archive for unpacking", "To delete archive after extraction if true" }, - CValueType.Void, - CValueType.String, CValueType.Boolean)] - [Method("unpack", - "Extract data from protected archive into same directory and delete it after extraction if needed.", - new string[] { "file", "delete", "pwd" }, - new string[] { "Archive for unpacking", "To delete archive after extraction if true", "Password of archive" }, - CValueType.Void, - CValueType.String, CValueType.Boolean, CValueType.String)] - protected string stUnpack(IPM pm) - { - if(pm.FinalEmptyIs(LevelType.Method, "unpack")) { - return unpack(pm.FirstLevel, pm); - } - - //TODO: ~ unpack.files(...) - throw new IncorrectNodeException(pm); - } - - /// - /// Prepares signatures: - /// unpack(file [, output][, delete][, pwd]) - /// - /// - /// - /// - protected string unpack(ILevel level, IPM pm) - { - // unpack(string file) - if(level.Is(ArgumentType.StringDouble)) { - return stUnpackMethod(pm, (string)level.Args[0].data); - } - - // unpack(string file, string output) - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble)) { - return stUnpackMethod(pm, (string)level.Args[0].data, (string)level.Args[1].data); - } - - // unpack(string file, string output, string pwd) - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.StringDouble)) { - return stUnpackMethod(pm, (string)level.Args[0].data, (string)level.Args[1].data, false, (string)level.Args[2].data); - } - - // unpack(string file, string output, boolean delete) - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.Boolean)) { - return stUnpackMethod(pm, (string)level.Args[0].data, (string)level.Args[1].data, (bool)level.Args[2].data); - } - - // unpack(string file, string output, boolean delete, string pwd) - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble, ArgumentType.Boolean, ArgumentType.StringDouble)) { - return stUnpackMethod(pm, (string)level.Args[0].data, (string)level.Args[1].data, (bool)level.Args[2].data, (string)level.Args[3].data); - } - - // unpack(string file, boolean delete) - if(level.Is(ArgumentType.StringDouble, ArgumentType.Boolean)) { - return stUnpackMethod(pm, (string)level.Args[0].data, null, (bool)level.Args[1].data); - } - - // unpack(string file, boolean delete, string pwd) - if(level.Is(ArgumentType.StringDouble, ArgumentType.Boolean, ArgumentType.StringDouble)) { - return stUnpackMethod(pm, (string)level.Args[0].data, null, (bool)level.Args[1].data, (string)level.Args[2].data); - } - - throw new InvalidArgumentException("Incorrect arguments to `unpack(string file [, string output][, boolean delete][, string pwd])`"); - } - - /// - /// Unpacking archive for signature: - /// unpack(string file [, string output][, boolean delete][, string pwd]) - /// - /// - /// Archive for unpacking. - /// Output path to unpacking archive data. - /// To delete archive after extracting data if true. - /// password of archive if used. - /// - protected string stUnpackMethod(IPM pm, string file, string output = null, bool delete = false, string pwd = null) - { - Log.Trace("stUnpackMethod: `{0}` -> `{1}` : delete({2}), pwd({3})", file, output, delete, (pwd == null)? "none" : "***"); - - file = pathToFile(file); - - if(output == null) { - output = getDirectoryFromFile(file); // same path - } - else if(String.IsNullOrWhiteSpace(output)) { - throw new InvalidArgumentException("The `output` argument can't be empty."); - } - else { - output = location(output); - } - - extractArchive(file, output, delete, pwd); - return Value.Empty; - } - - /// Archive for unpacking. - /// Output path to unpacking archive data. - /// To delete archive after extracting data if true. - /// password of archive if used. - protected virtual void extractArchive(string file, string output, bool delete, string pwd) - { - using(var zip = String.IsNullOrEmpty(pwd) ? new SevenZipExtractor(file) : new SevenZipExtractor(file, pwd)) - { - try { - zip.ExtractArchive(output); - } - catch(SevenZipArchiveException ex) { - throw new SBEException("Failed extraction data from archive. Check also your password if it's required.", ex); - } - } - - if(delete) { - File.Delete(file); - } - } - - /// - /// Work with the checking node. - /// Sample: #[7z check] - /// - /// - /// - [Method("check", - "Verification data of archive.\nReturns true if no any errors for archive.", - new string[] { "file" }, - new string[] { "Archive for testing" }, - CValueType.Boolean, - CValueType.String)] - [Method("check", - "Verification data of archive.\nReturns true if no any errors for archive.", - new string[] { "file", "pwd" }, - new string[] { "Archive for testing", "Password of archive" }, - CValueType.Boolean, - CValueType.String, CValueType.String)] - protected string stCheck(IPM pm) - { - if(pm.FinalEmptyIs(LevelType.Method, "check")) { - return check(pm.FirstLevel, pm); - } - - throw new IncorrectNodeException(pm); - } - - /// - /// Prepares signatures: - /// check(file [, pwd]) - /// - /// - /// - /// - protected string check(ILevel level, IPM pm) - { - // check(string file) - if(level.Is(ArgumentType.StringDouble)) { - return stCheckMethod(pm, (string)level.Args[0].data); - } - - // check(string file, string pwd) - if(level.Is(ArgumentType.StringDouble, ArgumentType.StringDouble)) { - return stCheckMethod(pm, (string)level.Args[0].data, (string)level.Args[1].data); - } - - throw new InvalidArgumentException("Incorrect arguments to `check(string file [, string pwd])`"); - } - - /// - /// Checking archive for signature: - /// check(string file [, string pwd]) - /// - /// - /// Archive for unpacking. - /// password of archive if used. - /// - protected string stCheckMethod(IPM pm, string file, string pwd = null) - { - Log.Trace("stUnpackMethod: `{0}` pwd({1})", file, (pwd == null)? "none" : "***"); - return checkArchive(pathToFile(file), pwd); - } - - /// Archive for unpacking. - /// password of archive if used. - /// - protected virtual string checkArchive(string file, string pwd) - { - using(var zip = String.IsNullOrEmpty(pwd) ? new SevenZipExtractor(file) : new SevenZipExtractor(file, pwd)) - { - try { - return Value.from(zip.Check()); - } - catch(SevenZipArchiveException ex) { - throw new SBEException("Failed extraction data from archive. Check also your password if it's required.", ex); - } - } - } - - /// - /// Gets path to item with location for current context. - /// - /// - /// Combined path to file or directory. - protected virtual string location(string item) - { - return Path.Combine(Settings.WPath, item); - } - - /// - /// Path to directory - protected virtual string getDirectoryFromFile(string file) - { - return Path.Combine(Path.GetDirectoryName(file), Path.GetFileNameWithoutExtension(file)); - } - - /// - /// Position from list if used (is not -1) - /// - private string pathToFile(string file, int idx = -1) - { - if(String.IsNullOrWhiteSpace(file)) { - throw new InvalidArgumentException("File name is empty. {0}", - (idx != -1)? String.Format("Fail in '{0}' position.", idx) : ""); - } - - string fullpath = location(file); - - if(fullpath.IndexOf('*') == -1 && !File.Exists(fullpath)) { // check existence of file if it's non-mask - throw new NotFoundException("File `{0}` is not found. Looked as `{1}`. {2}", - file, - fullpath, - (idx != -1)? String.Format("Fail in '{0}' position.", idx) : ""); - } - - return fullpath; - } - } -} \ No newline at end of file diff --git a/vsSolutionBuildEvent/SBEScripts/Components/TryComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/TryComponent.cs deleted file mode 100644 index 951f7f1d..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/TryComponent.cs +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - /// - /// try/catch for user scripts - /// - [Definition("try", "try/catch")] - [Definition("{ }catch{ }", "try/catch\n\nProtects from errors in try{...} block and handles it in catch{...}", "try")] - [Definition("{ }catch(err, msg){ }", "try/catch with error type and its message.", "try")] - public class TryComponent: Component, IComponent - { - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "try"; } - } - - /// - /// To force post-analysis. - /// - public override bool PostParse - { - get { return true; } - } - - /// - /// Should be located before deepening - /// - public override bool BeforeDeepen - { - get { return true; } - } - - /// - /// Main rule of container. - /// - protected string Rule - { - get - { - return String.Format( - @"^\[\s* - try - \s*{0}\s* #1 - try - catch - (?:\s* - \((?'args'.*?)\) #args - optional arguments - \s*)? - \s*{0}\s* #2 - catch - \]", - RPattern.CurlyBracketsContent - ); - } - } - - /// - /// Compiled rule. - /// - protected Regex CRule - { - get - { - if(crule == null) { - crule = new Regex(Rule, - RegexOptions.IgnorePatternWhitespace | - RegexOptions.Singleline | - RegexOptions.Compiled); - } - return crule; - } - } - private Regex crule; - - /// Used environment - /// Instance of user-variables - public TryComponent(IEnvironment env, IUserVariable uvariable) - : base(env, uvariable) - { - - } - - /// Initialization with loader - public TryComponent(IBootloader loader) - : base(loader) - { - - } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - var hString = new StringHandler(); - - Match m = CRule.Match(hString.protectMixedQuotes(data.Trim())); - if(!m.Success) { - throw new SyntaxIncorrectException("Failed TryComponent - '{0}'", data); - } - - string blockTry = hString.recovery(m.Groups[1].Value); - string blockCatch = hString.recovery(m.Groups[2].Value); - string args = (m.Groups["args"].Success)? hString.recovery(m.Groups["args"].Value) : null; - - try { - return evaluate(blockTry); - } - catch(Exception ex) { - return doCatch(blockCatch, ex, (new PM()).arguments(args)); - } - } - - protected string doCatch(string cmd, Exception ex, Argument[] args) - { - Log.Info($"Catched error `{ex.Message}`"); - - if(args == null) { - return evaluate(cmd); - } - - if(args.Length == 2 - && args[0].type == ArgumentType.EnumOrConst - && args[1].type == ArgumentType.EnumOrConst) - { - // try{ }catch(err, msg){ } - return doCatch(cmd, ex, args[0].data.ToString(), args[1].data.ToString()); - } - - throw new NotSupportedOperationException("the format of the catch block is incorrect or not supported yet."); - } - - protected string doCatch(string cmd, Exception ex, string err, string msg) - { - try { - setvar(err, ex.GetType().FullName); - setvar(msg, ex.Message); - - return evaluate(cmd); - } - finally { - delvar(err, msg); - } - } - - private void setvar(string name, string value) - { - uvariable.set(name, null, value); - uvariable.evaluate(name, null, new EvaluatorBlank(), true); - } - - private void delvar(params string[] names) - { - if(names == null) { - return; - } - - foreach(string name in names) { - uvariable.unset(name, null); - } - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Components/UserVariableComponent.cs b/vsSolutionBuildEvent/SBEScripts/Components/UserVariableComponent.cs deleted file mode 100644 index 75196fd2..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Components/UserVariableComponent.cs +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.SBEScripts.Components -{ - /// - /// Works with User-Variables - /// - [Definition("var", "Dynamic User-Variables")] - [Definition("name", "Get data from variable 'name'", "var")] - [Definition("name = ", "Set mixed data for variable 'name'", "var")] - [Definition("-name", "Unset variable 'name'", "var")] - [Definition("+name", "Default value for variable 'name'", "var")] - public class UserVariableComponent: Component, IComponent - { - /// - /// Default value for user-variables. - /// The '*Undefined*' as value for compatibility with MSBuild core. - /// - public const string UVARIABLE_VALUE_DEFAULT = MSBuild.Parser.PROP_VALUE_DEFAULT; - - /// - /// Ability to work with data for current component - /// - public override string Condition - { - get { return "var "; } - } - - /// Used environment - /// Instance of used user-variables - public UserVariableComponent(IEnvironment env, IUserVariable uvariable) - : base(env, uvariable) - { - - } - - /// Initialization with loader - public UserVariableComponent(IBootloader loader) - : base(loader) - { - - } - - /// - /// Handler for current data - /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) - { - Match m = Regex.Match(data, @"^\[var - \s+ - (\+|-) #1 - operation - ([A-Za-z_0-9]+) #2 - name - (?: - :([^=\]]+) #3 - project (optional) - )? - \s* - \]$", - RegexOptions.IgnorePatternWhitespace); - - if(!m.Success) { - return std(data); - } - - string op = m.Groups[1].Value; - string name = m.Groups[2].Value; - string project = (m.Groups[3].Success)? m.Groups[3].Value.Trim() : null; - - Log.Trace("`{0}`: found `{0}` as operation", ToString(), op); - switch(op) - { - case "+": { - Log.Debug("UVariable: set default value for variable - '{0}':'{1}'", name, project); - set(name, project, UVARIABLE_VALUE_DEFAULT); - return Value.Empty; - } - case "-": { - Log.Debug("UVariable: unset variable - '{0}':'{1}'", name, project); - unset(name, project); - return Value.Empty; - } - } - - throw new SubtypeNotFoundException("UVariable: the type '{0}' of operation was not found :: `{1}`", op, data); - } - - /// - /// Standard operations with variables - /// - /// mixed data - /// prepared and evaluated data - protected string std(string data) - { - Log.Trace("UVariable: use std handler"); - Match m = Regex.Match(data, @"^\[var - \s+ - ([A-Za-z_0-9]+) #1 - name - (?: - :([^=\]]+) #2 - project (optional) - )? - \s* - (?: - =\s* - (.*) #3 - mixed data for definition (optional) - )? - \]$", // #3 - greedy, however it's controlled by main container of SBE-Script - RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline); - - if(!m.Success) { - throw new SyntaxIncorrectException("Failed UserVariableComponent - '{0}'", data); - } - - string name = m.Groups[1].Value; - string project = (m.Groups[2].Success)? m.Groups[2].Value.Trim() : null; - string value = (m.Groups[3].Success)? m.Groups[3].Value : null; - - Log.Trace("UVariable: found '{0}':'{1}' = '{2}'", name, project, value); - if(value != null) { - set(name, project, value); - return Value.Empty; - } - return get(name, project); - } - - /// - /// Setting user-variable with the scope of project - /// - /// Variable name - /// Project name - /// Mixed value for variable - protected void set(string name, string project, string value) - { - uvariable.set(name, project, value); - evaluate(name, project); - } - - /// - /// Setting user-variable only with simple name - /// - /// Variable name - /// Mixed value for variable - protected void set(string name, string value) - { - set(name, null, value); - } - - /// - /// Removes user-variable by using scope of project - /// - /// variable name - /// project name - protected void unset(string name, string project = null) - { - uvariable.unset(name, project); - } - - /// - /// Getting value from user-value - /// - /// variable name - /// scope of project - /// evaluated value from found variable - /// if not found - protected string get(string name, string project = null) - { - if(!uvariable.isExist(name, project)) { - throw new NotFoundException("UVariable '{0}:{1}' not found", name, project); - } - - if(uvariable.isUnevaluated(name, project)) { - evaluate(name, project); - } - return uvariable.get(name, project); - } - - protected virtual void evaluate(string name, string project = null) - { - uvariable.evaluate(name, project, (IEvaluator)script, true); - if(PostProcessingMSBuild) { - uvariable.evaluate(name, project, (IEvaluator)msbuild, false); - } - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/CompletionData.cs b/vsSolutionBuildEvent/SBEScripts/Dom/CompletionData.cs deleted file mode 100644 index 66f56303..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/CompletionData.cs +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using ICSharpCode.AvalonEdit.CodeCompletion; -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - public class CompletionData: ICompletionData - { - /// - /// Image in the list - /// - public ImageSource Image - { - get; - protected set; - } - - /// - /// Used to filter the list of visible elements and inserting - /// - public string Text - { - get; - protected set; - } - - /// - /// Text to display in the list - /// - public object Content - { - get { return (content)?? Text; } - } - protected object content; - - /// - /// Description for tooltip - /// - public object Description - { - get; - protected set; - } - - /// - /// Used in the selection logic to selecting those items - /// which the user is accessing most frequently. - /// - public double Priority - { - get { return 0; } - } - - /// - /// Perform the completion - /// - /// The text area on which completion is performed. - /// The text segment that was used by the completion window if - /// the user types (segment between CompletionWindow.StartOffset and CompletionWindow.EndOffset). - /// The EventArgs used for the insertion request. - /// These can be TextCompositionEventArgs, KeyEventArgs, MouseEventArgs, depending on how - /// the insertion was triggered. - public void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs) - { - int pos = completionSegment.Offset; - for(int i = pos - 1; i >= 0; --i) { - if(!char.IsLetterOrDigit(textArea.Document.Text[i])) { - pos = i + 1; - break; - } - } - textArea.Document.Replace(pos, completionSegment.EndOffset - pos, Text); - } - - /// Used to filter the list of visible elements and inserting - /// Text to display in the list - /// Description for tooltip - /// Image in the list - public CompletionData(string text, string content, string description, ImageSource image = null) - { - Text = text; - Description = description; - Image = image; - } - - /// Used to filter the list of visible elements and inserting - /// Description for tooltip - /// Image in the list - public CompletionData(string text, string description, ImageSource image = null) - : this(text, null, description, image) - { - - } - - /// Used to filter the list of visible elements and inserting - /// Text to display in the list - /// Description for tooltip - /// Image in the list - public CompletionData(string text, string content, string description, Bitmap image) - : this(text, description) - { - Image = imageFrom(image); - } - - /// Used to filter the list of visible elements and inserting - /// Description for tooltip - /// Image in the list - public CompletionData(string text, string description, Bitmap image) - : this(text, null, description, image) - { - - } - - /// Used to filter the list of visible elements and inserting - /// Text to display in the list - /// Description for tooltip - /// Type of used element - public CompletionData(string text, string content, string description, InfoType type) - : this(text, description) - { - Image = imageFrom(type); - this.content = content; - } - - /// Used to filter the list of visible elements and inserting - /// Description for tooltip - /// Type of used element - public CompletionData(string text, string description, InfoType type) - : this(text, null, description, type) - { - - } - - protected ImageSource imageFrom(InfoType type) - { - switch(type) { - case InfoType.Component: { - return imageFrom(Icon.package); - } - case InfoType.Definition: { - return imageFrom(Icon.definition); - } - case InfoType.Property: { - return imageFrom(Icon.property); - } - case InfoType.Method: { - return imageFrom(Icon.function); - } - case InfoType.AliasToDefinition: - case InfoType.AliasToComponent: { - return imageFrom(Icon.alias); - } - } - return null; - } - - protected ImageSource imageFrom(Bitmap bmap) - { - MemoryStream ms = new MemoryStream(); - bmap.Save(ms, ImageFormat.Png); - - BitmapImage img = new BitmapImage(); - img.BeginInit(); - img.StreamSource = ms; - img.EndInit(); - - return img; - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/ComponentAttribute.cs b/vsSolutionBuildEvent/SBEScripts/Dom/ComponentAttribute.cs deleted file mode 100644 index 66c3bb93..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/ComponentAttribute.cs +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)] - public class ComponentAttribute: Attribute, IAttrDomLevelA - { - /// - /// Component name - /// - public string Name - { - get; - protected set; - } - - /// - /// About component - /// - public string Description - { - get; - protected set; - } - - /// - /// Name of parent specification if exist or null - /// - public string Parent - { - get; - protected set; - } - - /// - /// Aliases for primary name if used - /// - public string[] Aliases - { - get; - protected set; - } - - - /// Componen name - /// About component - /// Name of parent specification if exist or null - public ComponentAttribute(string name, string description, string parent) - { - Name = name; - Description = description; - Parent = parent; - } - - /// Componen name - /// About component - public ComponentAttribute(string name, string description) - : this(name, description, null) - { - - } - - /// Componen name - /// Aliases for primary name - /// About component - /// Name of parent specification if exist or null - public ComponentAttribute(string name, string[] aliases, string description, string parent) - : this(name, description, null) - { - Aliases = aliases; - } - - /// Componen name - /// Aliases for primary name - /// About component - public ComponentAttribute(string name, string[] aliases, string description) - : this(name, aliases, description, null) - { - - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/DefinitionAttribute.cs b/vsSolutionBuildEvent/SBEScripts/Dom/DefinitionAttribute.cs deleted file mode 100644 index c0df9ab2..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/DefinitionAttribute.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true)] - public class DefinitionAttribute: Attribute, IAttrDomLevelA - { - /// - /// Definition name - /// - public string Name - { - get; - protected set; - } - - /// - /// About of the definition - /// - public string Description - { - get; - protected set; - } - - /// - /// Name of parent specification if exist or null - /// - public string Parent - { - get; - protected set; - } - - /// Definition name - /// About of the definition - public DefinitionAttribute(string name, string description) - { - Name = name; - Description = description; - } - - /// Definition name - /// About of the definition - /// Name of parent specification if exist or null - public DefinitionAttribute(string name, string description, string parent) - { - Name = name; - Description = description; - Parent = parent; - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/DomParser.cs b/vsSolutionBuildEvent/SBEScripts/Dom/DomParser.cs deleted file mode 100644 index 012fa614..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/DomParser.cs +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using ICSharpCode.AvalonEdit.CodeCompletion; -using net.r_eg.vsSBE.MSBuild; - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - public class DomParser - { - /// - /// Caching of retrieved properties - /// - private ConcurrentDictionary> pcache = new ConcurrentDictionary>(); - - public enum KeysCommand - { - Default, - /// - /// Start of container '#['.. - /// - Container, - /// - /// Keys combination - [ctrl] + [space] - /// - CtrlSpace, - /// - /// Level of property/method etc. with '.' - /// - LevelByDot, - /// - /// Space key - /// - Space, - /// - /// Start of container '$('.. - /// - MSBuildContainer, - } - - /// - /// Mapper of the available components - /// - public IInspector Inspector - { - get; - protected set; - } - - public IMSBuild MSBuild - { - get; - protected set; - } - - protected IEnumerable ListEmpty - { - get { yield break; } - } - - protected IEnumerable ListNull - { - get { return null; } - } - - /// Where to find - /// Position in data to begin viewing - /// Pushed command - /// Complete list for code completion - public IEnumerable find(string data, int offset, KeysCommand cmd) - { - if(cmd == KeysCommand.Default) { - return ListEmpty; - } - - if(cmd == KeysCommand.MSBuildContainer) { // '#[' - root of the MSBuild container - return listMSBuildProperties(null); - } - - if(cmd == KeysCommand.Container) { // '#[' - root of the SBE container - return listComponents(null); - } - - data = region(data, offset); - - // '$( '<-- - if(Regex.IsMatch(data, @"\$\(\s*\w*$")) { - return (cmd == KeysCommand.CtrlSpace)? listMSBuildProperties() : ListNull; - } - - // '#[ '<-- - Match root = Regex.Match(data, @"\#\[ - (?: - (?'data'\S+) - | - \s* - )$", RegexOptions.IgnorePatternWhitespace); - - - if(root.Success) { - return (cmd == KeysCommand.CtrlSpace)? listComponents(root.Groups["data"].Value) : ListNull; - } - - // '#[...' --> - Match m = Regex.Match(data, @"^\#\[ - \s* - (\S+) #1 - Component - \s* - (.+)? #2 - properties/methods etc. (optional)", - RegexOptions.IgnorePatternWhitespace); - - if(!m.Success) { - return ListNull; - } - - INodeInfo component = findComponent(data); - if(component == null) { - // hidden components: - //Match hc = Regex.Match(data, @"^\s*\#\[(\S+)"); - //if(hc.Groups[1].Success) { - // return list(new NodeIdent(hc.Groups[1].Value, null)); - //} - return ListNull; - } - return find(cmd, component, (m.Groups[2].Success)? m.Groups[2].Value : null); - } - - public DomParser(IInspector inspector, IMSBuild msbuild = null) - { - Inspector = inspector; - MSBuild = msbuild; - } - - /// Pushed command - /// INodeInfo component for searching - /// Full raw string to finding - /// - protected IEnumerable find(KeysCommand cmd, INodeInfo component, string raw) - { - if(raw == null) - { - if(cmd == KeysCommand.CtrlSpace || cmd == KeysCommand.Space) { - return list(new NodeIdent(component.Name, null)); - } - return ListNull; - } - - if(cmd == KeysCommand.Space) { - return ListNull; - } - - string ident = (new StringHandler()).protectMixedQuotes(raw.Trim()); - - if(_isLatest('.', ident)) - { - ident = ident.Substring(0, ident.Length - 1); - if(cmd == KeysCommand.CtrlSpace) { - cmd = KeysCommand.LevelByDot; - } - } - - if(cmd == KeysCommand.CtrlSpace) - { - if(Regex.IsMatch(raw, @"(?: - \s+ - | - \([^.)]*? - | - \) - )$", RegexOptions.IgnorePatternWhitespace)) - { - return ListNull; - } - } - - string[] parts = Regex.Replace(ident, - RPattern.RoundBracketsContent, - "()", - RegexOptions.IgnorePatternWhitespace - ).Split('.'); - - NodeIdent id = new NodeIdent(component.Name, null); - for(int i = 0; i < parts.Length; ++i) - { - parts[i] = parts[i].Trim(); - - if(cmd == KeysCommand.CtrlSpace && i == parts.Length - 1) { - return list(id, parts[i]); - } - - INodeInfo info = infoBy(parts[i], id, (cmd == KeysCommand.LevelByDot)); - if(info == null) { - return ListEmpty; - } - - id = info.Link; - } - - if(cmd == KeysCommand.LevelByDot) { - return list(id); - } - return ListEmpty; - } - - /// Element name - /// Identificator of node - /// - /// null value if not found - protected INodeInfo infoBy(string name, NodeIdent ident, bool strict) - { - foreach(INodeInfo info in Inspector.getBy(ident)) - { - if(String.IsNullOrEmpty(info.Name)) { // hidden property - return infoBy(name, info.Link, strict); - } - - string elem = (new StringHandler()).protectMixedQuotes(info.Name); - elem = Regex.Replace(elem, RPattern.RoundBracketsContent, "()", RegexOptions.IgnorePatternWhitespace); - - if((strict && elem == name) - || (!strict && elem.Contains(name))) - { - return info; - } - } - return null; - } - - /// - /// Gets working region for data - /// - /// - /// - /// - protected string region(string data, int offset) - { - string reduced = data.Substring(0, offset); - int pos = reduced.LastIndexOf("#["); - - if(pos != -1) { - return data.Substring(pos, offset - pos); - } - return reduced; - } - - /// Component name - /// - protected IEnumerable listComponents(string name) - { - foreach(INodeInfo info in Inspector.Root) { - if(!String.IsNullOrEmpty(name) && !info.Name.Contains(name)) { - continue; - } - yield return new CompletionData(info.Name, info.Description, info.Type); - } - } - - protected IEnumerable listMSBuildProperties(string project = null) - { - foreach(MSBuild.PropertyItem prop in getMSBProperties(project)) { - if(!String.IsNullOrWhiteSpace(prop.name)) { - yield return new CompletionData(prop.name, prop.value, InfoType.Definition); - } - } - } - - protected IEnumerable list(NodeIdent ident, string name = null) - { - INodeInfo hidden = isHiddenLevel(ident); - if(hidden != null) { - foreach(ICompletionData inf in list(hidden.Link, name)) { - yield return inf; - } - } - else - { - foreach(INodeInfo inf in Inspector.getBy(ident)) { - if(!String.IsNullOrEmpty(name) && !inf.Name.Contains(name)) { - continue; - } - - yield return new CompletionData( - inf.Name, - inf.Displaying, - String.Format("{0}\n{1}\n{2}", inf.Description, new String('_', 20), inf.Signature), - inf.Type); - } - } - } - - /// - /// node of the hidden level or null value if level is not hidden - protected INodeInfo isHiddenLevel(NodeIdent ident) - { - INodeInfo ret = null; - foreach(INodeInfo info in Inspector.getBy(ident)) { - if(!String.IsNullOrEmpty(info.Name)) { - return null; - } - ret = info; - } - return ret; - } - - protected INodeInfo findComponent(string data) - { - foreach(INodeInfo info in Inspector.Root) - { - if(info.Type != InfoType.Component && info.Type != InfoType.AliasToComponent - && info.Type != InfoType.Definition && info.Type != InfoType.AliasToDefinition) - { - continue; - } - - if(data.StartsWith(String.Format("#[{0}", info.Name))) { //TODO: IComponent <- Condition - return info; - } - } - return null; - } - - private List getMSBProperties(string project) - { - string key = project; - if(String.IsNullOrEmpty(key)) { - key = "default"; - } - - if(!pcache.ContainsKey(key)) - { - if(MSBuild == null) { - return new List(); - } - pcache[key] = MSBuild.listProperties(project); - Log.Debug("Properties has been saved in cache ['{0}']", key); - } - return pcache[key]; - } - - private bool _isLatest(char symbol, string data) - { - return (!String.IsNullOrEmpty(data) && data[data.Length - 1] == symbol); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/IAttrDomLevelA.cs b/vsSolutionBuildEvent/SBEScripts/Dom/IAttrDomLevelA.cs deleted file mode 100644 index ad1a79d0..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/IAttrDomLevelA.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - public interface IAttrDomLevelA - { - /// - /// Element name - /// - string Name { get; } - - /// - /// About of element - /// - string Description { get; } - - /// - /// Name of parent specification - /// - string Parent { get; } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/IAttrDomLevelB.cs b/vsSolutionBuildEvent/SBEScripts/Dom/IAttrDomLevelB.cs deleted file mode 100644 index d0ad49fb..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/IAttrDomLevelB.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - public interface IAttrDomLevelB - { - /// - /// Name of the parent specification - /// - string Parent { get; } - - /// - /// Actual/real method name of the parent specification - /// - string Method { get; } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/IInspector.cs b/vsSolutionBuildEvent/SBEScripts/Dom/IInspector.cs deleted file mode 100644 index 68c8abed..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/IInspector.cs +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using net.r_eg.vsSBE.SBEScripts.Components; - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - public interface IInspector - { - /// - /// List of the constructed root-data - /// - IEnumerable Root { get; } - - /// - /// List of constructed data by identification of node - /// - /// - /// - IEnumerable getBy(NodeIdent ident); - - /// - /// List of constructed data by type of component - /// - /// - /// - IEnumerable getBy(Type type); - - /// - /// List of constructed data by IComponent - /// - /// - /// - IEnumerable getBy(IComponent component); - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/INodeInfo.cs b/vsSolutionBuildEvent/SBEScripts/Dom/INodeInfo.cs deleted file mode 100644 index 74d1699b..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/INodeInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - public interface INodeInfo - { - /// - /// Element name - /// - string Name { get; } - - /// - /// Description for current element - /// - string Description { get; } - - /// - /// Technical description of the method/property - /// - string Signature { get; } - - /// - /// Displays element over the 'Name' property. - /// In general this useful for code completion - /// - string Displaying { get; } - - /// - /// Aliases for primary name if used - /// - string[] Aliases { get; } - - /// - /// Element type - /// - InfoType Type { get; } - - /// - /// Link to the binding with other node - /// - NodeIdent Link { get; } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/InfoType.cs b/vsSolutionBuildEvent/SBEScripts/Dom/InfoType.cs deleted file mode 100644 index e4783e27..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/InfoType.cs +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - /// - /// Type of used element in node - /// - public enum InfoType - { - /// - /// Basic type - /// - Unspecified, - - /// - /// Defaults for DefinitionAttribute - /// - Component, - - /// - /// Unspecified complex expression/construction - /// - Definition, - - /// - /// Defaults for MethodAttribute - /// - Method, - - /// - /// Defaults for PropertyAttribute - /// - Property, - - /// - /// Another variant of existing Component - /// - AliasToComponent, - - /// - /// Another variant of existing Definition - /// - AliasToDefinition, - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/Inspector.cs b/vsSolutionBuildEvent/SBEScripts/Dom/Inspector.cs deleted file mode 100644 index 73a22d08..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/Inspector.cs +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using net.r_eg.vsSBE.SBEScripts.Components; - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - using LInfo = ConcurrentDictionary>; - - public class Inspector: IInspector - { - /// - /// List of the constructed root-data - /// - public IEnumerable Root - { - get { return getBy(); } - } - - /// - /// Used loader - /// - protected IBootloader bootloader; - - /// - /// Main storage - /// - protected LInfo data = new LInfo(); - - /// - /// List of constructed data by identification of node - /// - /// Identificator of node - /// - public IEnumerable getBy(NodeIdent ident = new NodeIdent()) - { - if(data.ContainsKey(ident)) - { - foreach(INodeInfo elem in data[ident].OrderBy(p => p.Name)) { - if(isEnabled(elem.Name)) { - yield return elem; - } - } - } - } - - /// - /// List of constructed data by type of component - /// - /// Type of component - /// - public IEnumerable getBy(Type type) - { - return getBy(new NodeIdent(getComponentName(type), null)); - } - - /// - /// List of constructed data by IComponent - /// - /// - /// - public IEnumerable getBy(IComponent component) - { - return getBy(component.GetType()); - } - - public static bool isComponent(Type type) - { - if(type.IsClass && type.GetInterfaces().Contains(typeof(IComponent)) - && type.Name.EndsWith("Component")) //TODO: - { - return true; - } - return false; - } - - /// - /// Construct data from used components with IBootloader - /// - /// - public Inspector(IBootloader bootloader) - { - this.bootloader = bootloader; - foreach(IComponent c in bootloader.Registered) { -#if DEBUG - Log.Trace("Inspector: extracting from '{0}'", c.GetType().Name); -#endif - extract(c, data); - } - - if(data.Count < 1) { - return; - } - - // Aliases to components - foreach(var root in data[new NodeIdent()]) - { - if(root.Aliases == null) { - continue; - } - foreach(string alias in root.Aliases) { - data[new NodeIdent(alias, root.Link.method, root.Link.className)] = data[root.Link]; //shallow copies - } - } - } - - /// From - /// To - protected void extract(IComponent c, LInfo data) - { - Type type = c.GetType(); - - foreach(Attribute attr in type.GetCustomAttributes(true)) { - inspectLevelA(type, attr, data); - } - - foreach(MethodInfo minf in type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { - foreach(Attribute attr in Attribute.GetCustomAttributes(minf)) { - inspectLevelB(type, attr, minf, data); - } - } - } - - /// Type of element - /// Found attribute - /// Found method - /// - protected void inspectLevelB(Type type, Attribute attr, MethodInfo method, LInfo data) - { - if(!isComponent(type) - || (attr.GetType() != typeof(MethodAttribute) && attr.GetType() != typeof(PropertyAttribute))) - { - return; - } - - IAttrDomLevelB levB = (IAttrDomLevelB)attr; - string className = method.DeclaringType.FullName; - NodeIdent ident = new NodeIdent((levB.Parent)?? getComponentName(type), levB.Method, (levB.Method == null)? null : className); - - if(!data.ContainsKey(ident)) { - data[ident] = new List(); - } - className = (method.Name == null)? null : className; - - if(attr.GetType() == typeof(PropertyAttribute)) { - data[ident].Add(new NodeInfo((PropertyAttribute)attr, method.Name, className)); - return; - } - - if(attr.GetType() == typeof(MethodAttribute)) { - data[ident].Add(new NodeInfo((MethodAttribute)attr, method.Name, className)); - return; - } - } - - /// Type of element - /// Found attribute - /// - protected void inspectLevelA(Type type, Attribute attr, LInfo data) - { - if(!isComponent(type) - || (attr.GetType() != typeof(DefinitionAttribute) && attr.GetType() != typeof(ComponentAttribute))) - { - return; - } - - IAttrDomLevelA levA = (IAttrDomLevelA)attr; - NodeIdent ident = new NodeIdent(levA.Parent, null); - - if(!data.ContainsKey(ident)) { - data[ident] = new List(); - } - - if(attr.GetType() == typeof(DefinitionAttribute)) { - data[ident].Add(new NodeInfo((DefinitionAttribute)attr)); - return; - } - - if(attr.GetType() == typeof(ComponentAttribute)) - { - INodeInfo node = new NodeInfo((ComponentAttribute)attr); - data[ident].Add(node); - aliasesToNodeLevelA(node, data[ident]); - return; - } - } - - /// - /// Work with aliases to components and to definitions. - /// - /// Node with aliases - /// All nodes - protected void aliasesToNodeLevelA(INodeInfo node, List data) - { - if(node.Aliases == null || node.Aliases.Length < 1) { - return; - } - InfoType aliasType = (node.Type == InfoType.Component)? InfoType.AliasToComponent : InfoType.AliasToDefinition; - - foreach(string alias in node.Aliases) - { - data.Add(new NodeInfo(alias, - String.Format("Alias to '{0}' {1}\n{2}", node.Name, node.Type, node.Description), - new NodeIdent(node.Name, null), - aliasType)); - } - } - - /// - /// Checking the enabled status for element - /// - /// Element name from storage - /// - protected bool isEnabled(string elementName) - { - foreach(IComponent c in bootloader.Registered) - { - Type type = c.GetType(); - - if(getComponentName(type) == elementName) { - if(!c.Enabled) { - return false; - } - continue; - } - - string[] defs = getDefinitionsNames(type); - if(defs != null && defs.Any(def => def == elementName)) { - if(!c.Enabled) { - return false; - } - } - - // aliases - object attr = getCustomAttribute(type, typeof(ComponentAttribute), false); - if(attr == null) { - continue; - } - string[] aliases = ((ComponentAttribute)attr).Aliases; - if(aliases != null && aliases.Any(a => a == elementName)) - { - if(!c.Enabled) { - return false; - } - } - } - return true; - } - - /// - /// Gets names of definitions - /// - /// - /// Is what is specified with all the DefinitionAttribute - protected string[] getDefinitionsNames(Type type) - { - object[] attr = type.GetCustomAttributes(typeof(DefinitionAttribute), false); - if(attr == null) { - return null; - } - return attr.Select(p => ((DefinitionAttribute)p).Name).ToArray(); - } - - /// - /// Getting component name - /// - /// - /// Original name by class name or what is specified with the ComponentAttribute - protected string getComponentName(Type type) - { - object attr = getCustomAttribute(type, typeof(ComponentAttribute), false); - if(attr != null) { - return ((ComponentAttribute)attr).Name; - } - return type.Name; - } - - /// - /// Get the first custom attribute. - /// note: the GetCustomAttribute - allowed only with v4.5 from CustomAttributeExtensions - /// - /// - /// - /// - /// - private object getCustomAttribute(Type type, Type attributeType, bool inherit) - { - object[] attr = type.GetCustomAttributes(attributeType, inherit); - if(attr == null || attr.Length < 1) { - return null; - } - return attr[0]; - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/MethodAttribute.cs b/vsSolutionBuildEvent/SBEScripts/Dom/MethodAttribute.cs deleted file mode 100644 index c30ec56e..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/MethodAttribute.cs +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Linq; -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - /// - /// Specification of the hierarchy of methods - /// - [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] - public class MethodAttribute: Attribute, IAttrDomLevelB - { - public struct TArguments - { - public CValueType type; - public string name; - public string description; - - public TArguments(CValueType type, string name = "", string description = "") - { - this.type = type; - this.name = name; - this.description = description; - } - } - - /// - /// Method name - /// - public string Name - { - get; - protected set; - } - - /// - /// Description for current method - /// - public string Description - { - get; - protected set; - } - - /// - /// Return value - /// - public CValueType Return - { - get; - protected set; - } - - /// - /// Arguments of method - /// - public TArguments[] Arguments - { - get; - protected set; - } - - /// - /// Name of the parent specification (property/method/etc.) if exist or null - /// - public string Parent - { - get; - protected set; - } - - /// - /// Actual/real method name of the parent specification if exist or null - /// - public string Method - { - get; - protected set; - } - - /// Method name - /// Description for current method - /// Return value - /// Arguments of method - public MethodAttribute(string name, string description, CValueType ret = CValueType.Void, params CValueType[] args) - { - Name = name; - Description = description; - Return = ret; - Arguments = args.Select(arg => new TArguments(arg)).ToArray(); - } - - /// Method name - /// Return value - /// Arguments of method - public MethodAttribute(string name, CValueType ret = CValueType.Void, params CValueType[] args) - : this(name, String.Empty, ret, args) - { - - } - - /// Method name - /// Description for current method - /// Name of the parent specification (property/method/etc.) if exist or null - /// Actual/real method name of the parent specification if exist or null - /// Return value - /// Arguments of method - public MethodAttribute(string name, string description, string parent, string method, CValueType ret = CValueType.Void, params CValueType[] args) - : this(name, description, ret, args) - { - Parent = parent; - Method = method; - } - - /// Method name - /// Name of the parent specification (property/method/etc.) if exist or null - /// Actual/real method name of the parent specification if exist or null - /// Return value - /// Arguments of method - public MethodAttribute(string name, string parent, string method, CValueType ret = CValueType.Void, params CValueType[] args) - : this(name, String.Empty, parent, method, ret, args) - { - - } - - /// Method name - /// Description for current method - /// Arguments of method by name - /// Description for arguments - /// Return value - /// Arguments of method - public MethodAttribute(string name, string description, string[] argsName, string[] argsDesc, CValueType ret, params CValueType[] args) - : this(name, description, ret, args) - { - if(argsName == null || argsDesc == null) { - throw new InvalidArgumentException("null value is not valid for argsName/argsDesc"); - } - - if(args.Length != argsName.Length || args.Length != argsDesc.Length) { - throw new MismatchException("CValueType[] is not equal by count with argsName/argsDesc :: {0}", name); - } - - Arguments = args.Select((arg, i) => new TArguments(arg, argsName[i], argsDesc[i])).ToArray(); - } - - /// Method name - /// Arguments of method by name - /// Description for arguments - /// Return value - /// Arguments of method - public MethodAttribute(string name, string[] argsName, string[] argsDesc, CValueType ret, params CValueType[] args) - : this(name, String.Empty, argsName, argsDesc, ret, args) - { - - } - - /// Method name - /// Description for current method - /// Name of the parent specification (property/method/etc.) if exist or null - /// Actual/real method name of the parent specification if exist or null - /// Arguments of method by name - /// Description for arguments - /// Return value - /// Arguments of method - public MethodAttribute(string name, string description, string parent, string method, string[] argsName, string[] argsDesc, CValueType ret, params CValueType[] args) - : this(name, description, argsName, argsDesc, ret, args) - { - Parent = parent; - Method = method; - } - - /// Method name - /// Name of the parent specification (property/method/etc.) if exist or null - /// Actual/real method name of the parent specification if exist or null - /// Arguments of method by name - /// Description for arguments - /// Return value - /// Arguments of method - public MethodAttribute(string name, string parent, string method, string[] argsName, string[] argsDesc, CValueType ret, params CValueType[] args) - : this(name, String.Empty, parent, method, argsName, argsDesc, ret, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/NodeIdent.cs b/vsSolutionBuildEvent/SBEScripts/Dom/NodeIdent.cs deleted file mode 100644 index d7ae75c2..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/NodeIdent.cs +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - public struct NodeIdent - { - /// - /// Name of the parent specification (property/method/etc.) - /// - public string parent; - - /// - /// Actual/real method name of the parent specification - /// - public string method; - - /// - /// Actual class name if exists information - /// - public string className; - - /// Name of the parent specification (property/method/etc.) - /// Actual/real method name of the parent specification - /// Actual class name - public NodeIdent(string parent, string method, string className) - { - this.parent = parent; - this.method = method; - this.className = className; - } - - /// Name of the parent specification (property/method/etc.) - /// Actual/real method name of the parent specification - public NodeIdent(string parent, string method) - : this(parent, method, null) - { - - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/NodeInfo.cs b/vsSolutionBuildEvent/SBEScripts/Dom/NodeInfo.cs deleted file mode 100644 index b2096362..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/NodeInfo.cs +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Linq; - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - public class NodeInfo: INodeInfo - { - /// - /// Element name - /// - public string Name - { - get; - protected set; - } - - /// - /// Description for current element - /// - public string Description - { - get; - protected set; - } - - /// - /// Technical description of the method/property - /// - public string Signature - { - get; - protected set; - } - - /// - /// Displays element over the 'Name' property. - /// In general this useful for code completion - /// (Can be the same as 'Name' property) - /// - public string Displaying - { - get { return (displaying)?? Name; } - } - protected string displaying; - - /// - /// Aliases for primary name if used - /// - public string[] Aliases - { - get; - protected set; - } - - /// - /// Element type - /// - public InfoType Type - { - get { return type; } - } - protected InfoType type = InfoType.Unspecified; - - /// - /// Link to the binding with other node - /// - public NodeIdent Link - { - get; - protected set; - } - - /// Element name - /// Description for current element - /// Element type - /// Displays element over the 'Name' property - public NodeInfo(string name, string description, InfoType type = InfoType.Unspecified, string displaying = null) - { - Name = name; - Description = description; - this.type = type; - this.displaying = displaying; - } - - /// Element name - /// Description for current element - /// Link to the binding with other node - /// Element type - /// Displays element over the 'Name' property - public NodeInfo(string name, string description, NodeIdent ident, InfoType type = InfoType.Unspecified, string displaying = null) - : this(name, description, type, displaying) - { - Link = ident; - } - - /// Attribute of property - /// Current actual/real method name - /// Actual class name - public NodeInfo(PropertyAttribute attr, string method, string className = null) - : this(attr.Name, attr.Description, new NodeIdent(attr.Name, method, className), InfoType.Property) - { - try { - Signature = aboutProperty(attr.Get, attr.Set); - displaying = displayProperty(attr.Get, attr.Set); - Name = displaying; - - //TODO: - if(attr.Set == CValueType.Input) { - Name += ": ]"; - } - } - catch(Exception ex) { - Log.Warn("NodeInfo-PropertyAttribute: '{0}'", ex.Message); - } - } - - /// Attribute of property - /// Displays element over the 'Name' property - public NodeInfo(DefinitionAttribute attr, string displaying = null) - : this(attr.Name, attr.Description, new NodeIdent(attr.Name, null), InfoType.Definition, displaying) - { - - } - - /// Attribute of property - /// Displays element over the 'Name' property - public NodeInfo(ComponentAttribute attr, string displaying = null) - : this(attr.Name, attr.Description, new NodeIdent(attr.Name, null), InfoType.Component, displaying) - { - Aliases = attr.Aliases; - } - - /// Attribute of method - /// Current actual/real method name - /// Actual class name - public NodeInfo(MethodAttribute attr, string method, string className = null) - : this(attr.Name, attr.Description, new NodeIdent(attr.Name, method, className), InfoType.Method) - { - try { - Signature = aboutMethod(attr.Return, attr.Arguments); - displaying = displayMethod(attr.Return, attr.Arguments); - Name = displaying; - - //TODO: - if(attr.Arguments != null && attr.Arguments.Length > 0) { - if(attr.Arguments[attr.Arguments.Length - 1].type == CValueType.Input) { - Name = Name.Substring(0, displaying.LastIndexOf(',')) + "): ]"; - } - } - } - catch(Exception ex) { - Log.Warn("NodeInfo-MethodAttribute: '{0}'", ex.Message); - } - } - - /// - /// Builds the technical description of the property - /// - /// Value type for getting - /// Value type for setting - /// - private string aboutProperty(CValueType get, CValueType set) - { - return String.Format("Get: {0}\nSet: {1}", _type(get), _type(set)); - } - - /// - /// Formatting of the property for displaying - /// - /// Value type for getting - /// Value type for setting - /// - private string displayProperty(CValueType get, CValueType set) - { - return Name; - } - - /// - /// Builds the technical description of the method - /// - /// Return value - /// Arguments of method - /// - private string aboutMethod(CValueType ret, MethodAttribute.TArguments[] args) - { - string retString = _type(ret); - - if(args == null || args.Length < 1) { - return String.Format("{0} {1}({2})\n", retString, Name, _type(CValueType.Void)); - } - - if(args[0].name == null) { - return String.Format("{0} {1}({2})", retString, Name, String.Join(", ", args.Select(p => _type(p.type)))); - } - - string argsString = String.Join(", ", args.Select(p => String.Format("{0} {1}", _type(p.type), p.name))); - string argsDescription = String.Join("\n* ", args.Select(p => String.Format("{0} - {1}", p.name, p.description))); - - return String.Format("{0} {1}({2})\n* {3}", retString, Name, argsString, argsDescription); - } - - /// - /// Formatting of the method for displaying - /// - /// Return value - /// Arguments of method - /// - private string displayMethod(CValueType ret, MethodAttribute.TArguments[] args) - { - string aStr = (args != null && args.Length > 0)? String.Join(", ", args.Select(p => p.name)) : _type(CValueType.Void); - return String.Format("{0}({1})", Name, aStr); - } - - /// - /// Formatting the type for displaying - /// - /// - /// - private string _type(CValueType type) - { - return type.ToString().ToLower(); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/PropertyAttribute.cs b/vsSolutionBuildEvent/SBEScripts/Dom/PropertyAttribute.cs deleted file mode 100644 index 3f3352b5..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Dom/PropertyAttribute.cs +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.SBEScripts.Dom -{ - /// - /// Specification of the hierarchy of property - /// - [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] - public class PropertyAttribute: Attribute, IAttrDomLevelB - { - /// - /// Property name - /// - public string Name - { - get; - protected set; - } - - /// - /// Description for current property - /// - public string Description - { - get; - protected set; - } - - /// - /// Value type for getting - /// - public CValueType Get - { - get; - protected set; - } - - /// - /// Value type for setting - /// - public CValueType Set - { - get; - protected set; - } - - /// - /// Name of the parent specification (property/method/etc.) if exist or null - /// - public string Parent - { - get; - protected set; - } - - /// - /// Actual/real method name of the parent specification if exist or null - /// - public string Method - { - get; - protected set; - } - - /// Property name - /// Description for current property - /// Value type for getting - /// Value type for setting - public PropertyAttribute(string name, string description, CValueType get = CValueType.Void, CValueType set = CValueType.Void) - { - Name = name; - Description = description; - Get = get; - Set = set; - } - - /// Property name - /// Value type for getting - /// Value type for setting - public PropertyAttribute(string name, CValueType get = CValueType.Void, CValueType set = CValueType.Void) - : this(name, String.Empty, get, set) - { - - } - - /// Property name - /// Description for current property - /// Name of the parent specification (property/method/etc.) if exist or null - /// Actual/real method name of the parent specification if exist or null - /// Value type for getting - /// Value type for setting - public PropertyAttribute(string name, string description, string parent, string method, CValueType get = CValueType.Void, CValueType set = CValueType.Void) - : this(name, description, get, set) - { - Parent = parent; - Method = method; - } - - /// Property name - /// Name of the parent specification (property/method/etc.) if exist or null - /// Actual/real method name of the parent specification if exist or null - /// Value type for getting - /// Value type for setting - public PropertyAttribute(string name, string parent, string method, CValueType get = CValueType.Void, CValueType set = CValueType.Void) - : this(name, String.Empty, parent, method, get, set) - { - - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Exceptions/ArgumentPMException.cs b/vsSolutionBuildEvent/SBEScripts/Exceptions/ArgumentPMException.cs deleted file mode 100644 index c903b14c..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Exceptions/ArgumentPMException.cs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Linq; -using net.r_eg.vsSBE.SBEScripts.SNode; -using BaseInvalidArgumentException = net.r_eg.vsSBE.Exceptions.InvalidArgumentException; - -namespace net.r_eg.vsSBE.SBEScripts.Exceptions -{ - [Serializable] - public class ArgumentPMException: BaseInvalidArgumentException - { - public ArgumentPMException(ILevel level, string expected) - : base(message(level, expected)) - { - - } - - protected static string message(ILevel level, string expected) - { - string msg = String.Format("Incorrect arguments. Expected `{0}`", expected); - - if(level.Type != LevelType.Method || level.Args == null) { - return msg; - } - - return String.Format("{0} -> Actual: ({1})", - msg, - String.Join(", ", level.Args.Select(a => a.type.ToString()))); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Exceptions/IncorrectNodeException.cs b/vsSolutionBuildEvent/SBEScripts/Exceptions/IncorrectNodeException.cs deleted file mode 100644 index db1b59c2..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Exceptions/IncorrectNodeException.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Diagnostics; -using net.r_eg.vsSBE.SBEScripts.SNode; - -namespace net.r_eg.vsSBE.SBEScripts.Exceptions -{ - [Serializable] - public class IncorrectNodeException: OperationNotFoundException - { - public IncorrectNodeException() - : base(String.Empty) - { - - } - - public IncorrectNodeException(string message) - : base(message) - { - - } - - public IncorrectNodeException(string message, params object[] args) - : base(message, args) - { - - } - - /// - /// Throw error with IPM - /// - /// - /// Selected level. - public IncorrectNodeException(IPM pm, int level = 0) - : this() - { - if(pm != null) { - pm.fail(level, (new StackTrace()).GetFrame(1).GetMethod().Name); - } - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Exceptions/NotSupportedOperationException.cs b/vsSolutionBuildEvent/SBEScripts/Exceptions/NotSupportedOperationException.cs deleted file mode 100644 index 2a869829..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Exceptions/NotSupportedOperationException.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.SBEScripts.Exceptions -{ - [Serializable] - public class NotSupportedOperationException: ScriptException - { - public NotSupportedOperationException(string message) - : base(message) - { - - } - - public NotSupportedOperationException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Exceptions/OperandNotFoundException.cs b/vsSolutionBuildEvent/SBEScripts/Exceptions/OperandNotFoundException.cs deleted file mode 100644 index 84bcd01d..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Exceptions/OperandNotFoundException.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.SBEScripts.Exceptions -{ - [Serializable] - public class OperandNotFoundException: NotFoundException - { - public OperandNotFoundException(string message) - : base(message) - { - - } - - public OperandNotFoundException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Exceptions/OperationNotFoundException.cs b/vsSolutionBuildEvent/SBEScripts/Exceptions/OperationNotFoundException.cs deleted file mode 100644 index 0b871589..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Exceptions/OperationNotFoundException.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.SBEScripts.Exceptions -{ - [Serializable] - public class OperationNotFoundException: NotFoundException - { - public OperationNotFoundException(string message) - : base(message) - { - - } - - public OperationNotFoundException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Exceptions/ScriptException.cs b/vsSolutionBuildEvent/SBEScripts/Exceptions/ScriptException.cs deleted file mode 100644 index bb37d9bb..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Exceptions/ScriptException.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.SBEScripts.Exceptions -{ - [Serializable] - public class ScriptException: SBEException - { - public ScriptException(string message) - : base(message) - { - - } - - public ScriptException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Exceptions/SelectorMismatchException.cs b/vsSolutionBuildEvent/SBEScripts/Exceptions/SelectorMismatchException.cs deleted file mode 100644 index c968650e..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Exceptions/SelectorMismatchException.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.SBEScripts.Exceptions -{ - [Serializable] - public class SelectorMismatchException: ScriptException - { - public SelectorMismatchException(string message) - : base(message) - { - - } - - public SelectorMismatchException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Exceptions/SubtypeNotFoundException.cs b/vsSolutionBuildEvent/SBEScripts/Exceptions/SubtypeNotFoundException.cs deleted file mode 100644 index 26eea29a..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Exceptions/SubtypeNotFoundException.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.SBEScripts.Exceptions -{ - [Serializable] - public class SubtypeNotFoundException: ScriptException - { - public SubtypeNotFoundException(string message) - : base(message) - { - - } - - public SubtypeNotFoundException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Exceptions/SyntaxIncorrectException.cs b/vsSolutionBuildEvent/SBEScripts/Exceptions/SyntaxIncorrectException.cs deleted file mode 100644 index 90f95409..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Exceptions/SyntaxIncorrectException.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; - -namespace net.r_eg.vsSBE.SBEScripts.Exceptions -{ - [Serializable] - public class SyntaxIncorrectException: ScriptException - { - public SyntaxIncorrectException(string message) - : base(message) - { - - } - - public SyntaxIncorrectException(string message, params object[] args) - : base(message, args) - { - - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/IBootloader.cs b/vsSolutionBuildEvent/SBEScripts/IBootloader.cs deleted file mode 100644 index 4cdbacc3..00000000 --- a/vsSolutionBuildEvent/SBEScripts/IBootloader.cs +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.SBEScripts -{ - public interface IBootloader - { - /// - /// All enabled from the registered components - /// - IEnumerable Components { get; } - - /// - /// All registered components - /// - IEnumerable Registered { get; } - - /// - /// Operations with environment - /// - IEnvironment Env { get; } - - /// - /// Container for user-variables - /// - IUserVariable UVariable { get; } - - /// - /// Getting component for selected type - /// - /// - /// - IComponent getComponentByType(Type type); - - /// - /// To register new component. - /// - /// component - void register(IComponent c); - - /// - /// To register the all default components. - /// - void register(); - - /// - /// To unregister specific component. - /// - /// component - void unregister(IComponent c); - - /// - /// To unregister all available components. - /// - void unregister(); - - /// - /// Activation of components with ISolutionEvents. - /// - /// - void updateActivation(ISolutionEvents data); - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/ISBEScript.cs b/vsSolutionBuildEvent/SBEScripts/ISBEScript.cs deleted file mode 100644 index c9bacb9e..00000000 --- a/vsSolutionBuildEvent/SBEScripts/ISBEScript.cs +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.SBEScripts -{ - public interface ISBEScript - { - /// - /// Instance of used loader - /// - IBootloader Bootloader { get; } - - /// - /// Handler of mixed data SBE-Scripts - /// - /// mixed data - /// prepared and evaluated data - string parse(string data); - - /// - /// Handler of mixed data SBE-Scripts - /// - /// mixed data - /// Allows post-processing with MSBuild or not. - /// Some components can require immediate processing with evaluation, before passing control to next level. - /// - /// prepared and evaluated data - string parse(string data, bool allowMSBuild); - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/RPattern.cs b/vsSolutionBuildEvent/SBEScripts/RPattern.cs deleted file mode 100644 index a9d4ebeb..00000000 --- a/vsSolutionBuildEvent/SBEScripts/RPattern.cs +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Text.RegularExpressions; - -namespace net.r_eg.vsSBE.SBEScripts -{ - public static class RPattern - { - /// - /// General container of SBE-Scripts - /// - public static Regex Container - { - get - { - /* - ( - \#{1,2} - ) - (?= - ( - \[ - (?> - [^\[\]] - | - (?2) - )* - \] - ) - ) -> for .NET: v - */ - if(container == null) { - container = new Regex(@"(?:\r?\n\x20*)?\r?\n?( - \#{1,2} #1 - # or ## - ) - ( #2 - mixed data of SBE-Script - \[ - (?> - [^\[\]] - | - \[(?) - | - \](?<-R>) - )* - (?(R)(?!)) - \] - )\r?\n?", - RegexOptions.IgnorePatternWhitespace | - RegexOptions.Compiled); - } - return container; - } - } - private static Regex container; - - /// - /// Content from double quotes - /// - public static string DoubleQuotesContent - { - get { - if(doubleQuotesContent == null) { - doubleQuotesContent = quotesContent('"', true); - } - return doubleQuotesContent; - } - } - private static string doubleQuotesContent; - - /// - /// Content from single quotes - /// - public static string SingleQuotesContent - { - get { - if(singleQuotesContent == null) { - singleQuotesContent = quotesContent('\'', true); - } - return singleQuotesContent; - } - } - private static string singleQuotesContent; - - /// - /// Double quotes with content - /// - public static string DoubleQuotesContentFull - { - get { - if(doubleQuotesContentFull == null) { - doubleQuotesContentFull = quotesContent('"', false); - } - return doubleQuotesContentFull; - } - } - private static string doubleQuotesContentFull; - - /// - /// Single quotes with content - /// - public static string SingleQuotesContentFull - { - get { - if(singleQuotesContentFull == null) { - singleQuotesContentFull = quotesContent('\'', false); - } - return singleQuotesContentFull; - } - } - private static string singleQuotesContentFull; - - /// - /// Content from Square Brackets - /// [ ... ] - /// - public static string SquareBracketsContent - { - get { - if(squareBracketsContent == null) { - squareBracketsContent = bracketsContent('[', ']'); - } - return squareBracketsContent; - } - } - private static string squareBracketsContent; - - /// - /// Content from Parentheses (Round Brackets) - /// ( ... ) - /// - public static string RoundBracketsContent - { - get { - if(roundBracketsContent == null) { - roundBracketsContent = bracketsContent('(', ')'); - } - return roundBracketsContent; - } - } - private static string roundBracketsContent; - - /// - /// Content from Curly Brackets - /// { ... } - /// - public static string CurlyBracketsContent - { - get { - if(curlyBracketsContent == null) { - curlyBracketsContent = bracketsContent('{', '}'); - } - return curlyBracketsContent; - } - } - private static string curlyBracketsContent; - - /// - /// Boolean value from allowed syntax - /// - public static string BooleanContent - { - get { return @"\s*(true|false|True|False|TRUE|FALSE)\s*"; } - } - - /// - /// Integer value from allowed syntax - /// - public static string IntegerContent - { - get { return @"\s*(-?\d+)\s*"; } - } - - /// - /// Unsigned Integer value from allowed syntax - /// - public static string UnsignedIntegerContent - { - get { return @"\s*(\d+)\s*"; } - } - - /// - /// Signed floating-point number with single-precision from allowed syntax - /// - public static string FloatContent - { - get { return @"\s*(-?\d+(?:\.\d+)?)f\s*"; } - } - - /// - /// Unsigned floating-point number with single-precision from allowed syntax - /// - public static string UnsignedFloatContent - { - get { return @"\s*(\d+(?:\.\d+)?)f\s*"; } - } - - /// - /// Signed floating-point number with double-precision from allowed syntax - /// - public static string DoubleContent - { - get { return @"\s*(-?\d+(?:\.\d+)?)d?\s*"; } - } - - /// - /// Unsigned floating-point number with double-precision from allowed syntax - /// - public static string UnsignedDoubleContent - { - get { return @"\s*(\d+(?:\.\d+)?)d?\s*"; } - } - - /// - /// Mixed Enum or Const value from allowed syntax - /// - public static string EnumOrConstContent - { - get { return @"\s*([A-Za-z_0-9.]+)\s*"; } - } - - /// - /// Object data. Similar as array with mixed data. - /// Format: { "p1", true, { 12, 'n', -4.5f }, 12d } - /// - public static string ObjectContent - { - get { return CurlyBracketsContent; } - } - - /// - /// Char symbol value from allowed syntax - /// - public static string CharContent - { - get { return @"\s*'(\S{1})'\s*"; } - } - - /// - /// Content for present symbol of quotes - /// Escaping is a "\" for used symbol - /// e.g.: \', \" - /// - /// ' or " - /// - private static string quotesContent(char symbol, bool withoutQuotes = true) - { - return String.Format(@" - \s*(? - /// Content for present symbol of brackets - /// - /// Note: A balancing group definition deletes the definition of a previously defined group, - /// therefore allowed some intersection with name of the balancing group.. don't worry., be happy - /// - /// left symbol of bracket: [, {, ( etc. - /// right symbol of bracket: ], }, ) etc. - private static string bracketsContent(char open, char close) - { - return String.Format(@"\{0} - ( - (?> - [^\{0}\{1}] - | - \{0}(?) - | - \{1}(?<-R>) - )* - (?(R)(?!)) - ) - \{1}", open, close); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/SNode/Argument.cs b/vsSolutionBuildEvent/SBEScripts/SNode/Argument.cs deleted file mode 100644 index 2a55c72f..00000000 --- a/vsSolutionBuildEvent/SBEScripts/SNode/Argument.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.SBEScripts.SNode -{ - public struct Argument - { - /// - /// Value of argument. - /// - public object data; - - /// - /// Type of argument. - /// - public ArgumentType type; - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/SNode/ArgumentType.cs b/vsSolutionBuildEvent/SBEScripts/SNode/ArgumentType.cs deleted file mode 100644 index 2ca41d3b..00000000 --- a/vsSolutionBuildEvent/SBEScripts/SNode/ArgumentType.cs +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.SBEScripts.SNode -{ - /// - /// Specifies of possible types for arguments. - /// - public enum ArgumentType - { - /// - /// Unspecified mixed data. - /// - Mixed, - - /// - /// Common string. - /// - String, - - /// - /// String from single quotes. - /// - StringSingle, - - /// - /// String from double quotes. - /// - StringDouble, - - /// - /// Single symbol from single quotes. - /// - Char, - - /// - /// Boolean data. - /// - Boolean, - - /// - /// Signed Integer number. - /// - Integer, - - /// - /// Signed floating-point number with single-precision. - /// - Float, - - /// - /// Signed floating-point number with double-precision. - /// - Double, - - /// - /// Unspecified predefined data. - /// - EnumOrConst, - - /// - /// Predefined data as Enum. - /// - Enum, - - /// - /// Predefined data as Const. - /// - Const, - - /// - /// Object data. Similar as array with mixed data. - /// Format: { "p1", true, { 12, 'n', -4.5f }, 12d } - /// - Object, - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/SNode/EvalType.cs b/vsSolutionBuildEvent/SBEScripts/SNode/EvalType.cs deleted file mode 100644 index 8503669f..00000000 --- a/vsSolutionBuildEvent/SBEScripts/SNode/EvalType.cs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.SBEScripts.SNode -{ - /// - /// Available statuses for evaluation with MSBuild and other engines. - /// - public enum EvalType - { - None = 0x0, - - /// - /// String argument from double quotes. - /// - ArgStringD = 0x01, - - /// - /// String argument from single quotes. - /// - ArgStringS = 0x02, - - /// - /// Standard right operand via '=' - /// - RightOperandStd = 0x04, - - /// - /// Right operand via ':' - /// - RightOperandColon = 0x08, - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/SNode/ILevel.cs b/vsSolutionBuildEvent/SBEScripts/SNode/ILevel.cs deleted file mode 100644 index d6555bdf..00000000 --- a/vsSolutionBuildEvent/SBEScripts/SNode/ILevel.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Runtime.InteropServices; - -namespace net.r_eg.vsSBE.SBEScripts.SNode -{ - [Guid("99D0CB1C-ED79-4358-BF2B-67F2A5B1EEFB")] - public interface ILevel - { - /// - /// Type of level. - /// - LevelType Type { get; } - - /// - /// Data of level. - /// - string Data { get; } - - /// - /// Arguments of level. - /// - Argument[] Args { get; } - - /// - /// Type of data. - /// - CValueType DataType { get; set; } - - /// - /// Checks the argument types. - /// - /// The types that should be for this level. - /// True value if the Args contains arguments with specified types. - bool Is(params ArgumentType[] types); - - /// - /// Checks the argument types. - /// - /// Use string for exception instead of boolean result. - /// The types that should be for this level. - /// True value if the Args contains arguments with specified types. - bool Is(string exception, params ArgumentType[] types); - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/SNode/IPM.cs b/vsSolutionBuildEvent/SBEScripts/SNode/IPM.cs deleted file mode 100644 index e49ad0a9..00000000 --- a/vsSolutionBuildEvent/SBEScripts/SNode/IPM.cs +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -namespace net.r_eg.vsSBE.SBEScripts.SNode -{ - [Guid("DAEF9EE0-F8DA-4A70-BD5B-3517069EBFFF")] - public interface IPM - { - /// - /// Found levels. - /// - List Levels { get; } - - /// - /// Access to first level. - /// - ILevel FirstLevel { get; set; } - - /// - /// Condition for analyzer. - /// - string Condition { get; } - - /// - /// Checks equality for level. - /// - /// Selected level. - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - bool Is(int level, LevelType type, string data = null); - - /// - /// Checks equality for level with additional checking of finalization in levels chain. - /// - /// Selected level. - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - bool FinalIs(int level, LevelType type, string data = null); - - /// - /// Checks equality for level with additional checking of finalization as RightOperandEmpty in levels chain. - /// - /// Selected level. - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - bool FinalEmptyIs(int level, LevelType type, string data = null); - - /// - /// Slicing of current levels to selected. - /// - /// New start position. - /// Self reference. - IPM pinTo(int level); - - /// - /// Get all levels from selected. - /// - /// Start position. - /// New instance of IPM. - IPM getFrom(int level); - - /// - /// The string of diagnostic information about level. - /// - /// - /// - string traceLevel(int level = 0); - - /// - /// Throws error for level. - /// - /// - /// Custom id of place where occurred. - void fail(int level = 0, string ident = null); - - /// - /// Checks equality for zero level. - /// - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - bool Is(LevelType type, string data = null); - - /// - /// Checks equality for zero level with additional checking of finalization in levels chain. - /// - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - bool FinalIs(LevelType type, string data = null); - - /// - /// Checks equality for zero level with additional checking of finalization as RightOperandEmpty in levels chain. - /// - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - bool FinalEmptyIs(LevelType type, string data = null); - - /// - /// Checks equality for zero level and move to next level if it is equal to this data. - /// - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - bool It(LevelType type, string data = null); - - /// - /// Checks equality for specific level and move to next level if it is equal to this data. - /// - /// Selected level. - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - bool It(int level, LevelType type, string data = null); - - /// - /// Checks equality of method for specific level. - /// - /// Selected level. - /// Method name. - /// The arguments that should be. - /// - bool IsMethodWithArgs(int level, string name, params ArgumentType[] types); - - /// - /// Checks equality of method for zero level. - /// - /// Method name. - /// The arguments that should be. - /// - bool IsMethodWithArgs(string name, params ArgumentType[] types); - - /// - /// Checks type of right operand for zero level. - /// - /// The right operand should be with level type. - /// true value if the right operand is equal to selected level type, otherwise false. - bool IsRight(LevelType type); - - /// - /// Checks equality of data for zero level. - /// - /// Level should be with data. - /// Alternative variants that can be. - /// true value if selected level is equal to selected data, otherwise false. - bool IsData(string data, params string[] variants); - - /// - /// Extracts all arguments from raw data. - /// - /// Raw data of arguments. - /// A character that delimits arguments. - /// List of parsed arguments or null value if data is empty or null. - Argument[] arguments(string raw, char splitter = ','); - } -} \ No newline at end of file diff --git a/vsSolutionBuildEvent/SBEScripts/SNode/Level.cs b/vsSolutionBuildEvent/SBEScripts/SNode/Level.cs deleted file mode 100644 index 0ed5ac31..00000000 --- a/vsSolutionBuildEvent/SBEScripts/SNode/Level.cs +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.SBEScripts.SNode -{ - public struct Level: ILevel - { - /// - /// Type of level. - /// - public LevelType Type - { - get; - set; - } - - /// - /// Data of level. - /// - public string Data - { - get; - set; - } - - /// - /// Arguments of level if used. - /// - public Argument[] Args - { - get; - set; - } - - /// - /// Type of data. - /// - public CValueType DataType - { - get; - set; - } - - /// - /// Checks the argument types. - /// - /// The types that should be for this level. - /// True value if the Args contains arguments with specified types. - public bool Is(params ArgumentType[] types) - { - if(Args == null || types == null || Args.Length != types.Length) { - return false; - } - - for(int i = 0; i < Args.Length; ++i) - { - if(Args[i].type != types[i]) { - return false; - } - } - - return true; - } - - /// - /// Checks the argument types. - /// - /// Use string for exception instead of boolean result. - /// The types that should be for this level. - /// True value if the Args contains arguments with specified types. - public bool Is(string exception, params ArgumentType[] types) - { - bool val = Is(types); - - if(exception != null && !val) { - throw new InvalidArgumentException("Incorrect arguments to `{0}`", exception); - } - - return val; - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/SNode/LevelType.cs b/vsSolutionBuildEvent/SBEScripts/SNode/LevelType.cs deleted file mode 100644 index ec263157..00000000 --- a/vsSolutionBuildEvent/SBEScripts/SNode/LevelType.cs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Runtime.InteropServices; - -namespace net.r_eg.vsSBE.SBEScripts.SNode -{ - [Guid("C2390230-5828-4F2B-AF03-52E7DA3F8B10")] - public enum LevelType - { - /// - /// Property type. - /// - Property, - - /// - /// Method or function. - /// - Method, - - /// - /// Right operand through standard equal sign '='. - /// - RightOperandStd, - - /// - /// Right operand through colon ':'. - /// - RightOperandColon, - - /// - /// Unused right operand. - /// - RightOperandEmpty, - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/SNode/PM.cs b/vsSolutionBuildEvent/SBEScripts/SNode/PM.cs deleted file mode 100644 index 9a2b5a8d..00000000 --- a/vsSolutionBuildEvent/SBEScripts/SNode/PM.cs +++ /dev/null @@ -1,639 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.MSBuild; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.SBEScripts.SNode -{ - /// - /// Detector of PM levels. - /// - public class PM: IPM - { - protected IMSBuild msbuild; - protected EvalType teval = EvalType.None; - - /// - /// Condition for analyzer. - /// - public string Condition - { - get - { - return @"^\s*\.?\s* - (?: - ([A-Za-z_0-9]+)\s* #1 - method - \((.*?)\) #2 - arguments - | - ([A-Za-z_0-9]+) #3 - property - ) - \s*(.*) #4 - operation - "; - } - } - - /// - /// Found levels. - /// - public List Levels - { - get; - protected set; - } = new List(); - - /// - /// Access to first level. - /// - public ILevel FirstLevel - { - get - { - if(Levels.Count < 1) { - throw new InvalidArgumentException("PM: The first level is not initialized or not exists anymore."); - } - return Levels[0]; - } - set - { - if(Levels.Count < 1) { - throw new InvalidArgumentException("PM: Allowed only updating. Initialize first."); - } - Levels[0] = value; - } - } - - /// - /// Compiled rules of nodes. - /// - protected Regex Rcon - { - get - { - if(rcon == null) { - rcon = new Regex(Condition, - RegexOptions.IgnorePatternWhitespace | - RegexOptions.Singleline | - RegexOptions.Compiled); - } - return rcon; - } - } - private Regex rcon; - - /// - /// Checks equality for level. - /// - /// Selected level. - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - public bool Is(int level, LevelType type, string data = null) - { - if(level < 0 || level >= Levels.Count) { - return false; - } - ILevel lvl = Levels[level]; - - return (lvl.Type == type && lvl.Data == data); - } - - /// - /// Checks equality for level with additional checking of finalization in levels chain. - /// - /// Selected level. - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - /// If found level is equal to selected type and data but is not latest in levels chain. - public bool FinalIs(int level, LevelType type, string data = null) - { - bool ret = Is(level, type, data); - if(!ret) { - return false; - } - - if(isLastLevel(Levels[level])) { - return true; // if current is also the last - } - - // check next level - if(isLastLevel(Levels[level + 1])) { - return true; // 'as is' if next level is final. - } - - // the next level is not latest - throw new NotSupportedOperationException("PM - FinalIs: the level '{0}'({1}) is not final.", Levels[level].Data, Levels[level].Type); - } - - /// - /// Checks equality for level with additional checking of finalization as RightOperandEmpty in levels chain. - /// - /// Selected level. - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - /// If found level is equal to selected type and data but is not latest or is not RightOperandEmpty in levels chain. - public bool FinalEmptyIs(int level, LevelType type, string data = null) - { - bool ret = Is(level, type, data); - if(!ret) { - return false; - } - - if(Levels[level].Type == LevelType.RightOperandEmpty) { - return true; // if current is also the last - } - - // check next level - if(Levels[level + 1].Type == LevelType.RightOperandEmpty) { - return true; // 'as is' if next level is final and is RightOperandEmpty. - } - - // the next level is not latest or RightOperandEmpty - throw new NotSupportedOperationException("PM - FinalEmptyIs: the level '{0}'({1}) is not final.", Levels[level].Data, Levels[level].Type); - } - - /// - /// Slicing of current levels to selected. - /// - /// New start position. - /// Self reference. - public IPM pinTo(int level) - { - Levels = sliceLevels(level); - return this; - } - - /// - /// Get all levels from selected. - /// - /// Start position. - /// New instance of IPM. - public IPM getFrom(int level) - { - return new PM(sliceLevels(level)); - } - - /// - /// The string of diagnostic information about level. - /// - /// - /// - public string traceLevel(int level = 0) - { - if(level < 0 || level >= Levels.Count) { - return String.Format("Level '{0}' is not exists. /{1}", level, Levels.Count); - } - ILevel l = Levels[level]; - return String.Format("Data({0}), Type({1}), LevelType({2}), Args = {3}, Level({4}/{5})", - l.Data, l.DataType, l.Type, (l.Args == null) ? 0 : l.Args.Length, level, Levels.Count); - } - - /// - /// Throws error for level. - /// - /// - /// Custom id of place where occurred. - /// - public void fail(int level = 0, string ident = null) - { - string stMethod = ident ?? (new StackTrace()).GetFrame(1).GetMethod().Name; - throw new IncorrectNodeException("`{0}` Node - {1} is not correct for this way.", stMethod, traceLevel(level)); - } - - /// - /// Checks equality for zero level. - /// - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - public bool Is(LevelType type, string data = null) - { - return Is(0, type, data); - } - - /// - /// Checks equality for zero level with additional checking of finalization in levels chain. - /// - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - public bool FinalIs(LevelType type, string data = null) - { - return FinalIs(0, type, data); - } - - /// - /// Checks equality for zero level with additional checking of finalization as RightOperandEmpty in levels chain. - /// - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - public bool FinalEmptyIs(LevelType type, string data = null) - { - return FinalEmptyIs(0, type, data); - } - - /// - /// Checks equality for specific level and move to next level if it is equal to this data. - /// - /// Selected level. - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - public bool It(int level, LevelType type, string data = null) - { - if(!Is(level, type, data)) { - return false; - } - - if(Levels.Count == 1) { - Levels.Clear(); // current level is already checked - } - else { - pinTo(level + 1); // move to next - } - return true; - } - - /// - /// Checks equality for zero level and move to next level if it is equal to this data. - /// - /// Level should be with type. - /// Level should be with data. - /// true value if selected level is equal to selected type and data, otherwise false. - public bool It(LevelType type, string data = null) - { - return It(0, type, data); - } - - /// - /// Checks equality of method for specific level. - /// - /// Selected level. - /// Method name. - /// The arguments that should be. - /// - public bool IsMethodWithArgs(int level, string name, params ArgumentType[] types) - { - return Is(level, LevelType.Method, name) && Levels[level].Is(types); - } - - /// - /// Checks equality of method for zero level. - /// - /// Method name. - /// The arguments that should be. - /// - public bool IsMethodWithArgs(string name, params ArgumentType[] types) - { - return IsMethodWithArgs(0, name, types); - } - - /// - /// Checks type of right operand for zero level. - /// - /// The right operand should be with level type. - /// true value if the right operand is equal to selected level type, otherwise false. - public bool IsRight(LevelType type) - { - return Levels.Count > 0 && Levels[0].Type == type; - } - - /// - /// Checks equality of data for zero level. - /// - /// Level should be with data. - /// Alternative variants that can be. - /// true value if selected level is equal to selected data, otherwise false. - public bool IsData(string data, params string[] variants) - { - if(Levels.Count < 1) { - return false; - } - string ldata = Levels[0].Data; - - if(ldata == data) { - return true; - } - - if(variants.Any(v => ldata == v)) { - return true; - } - - return false; - } - - /// - /// Extracts all arguments from raw data. - /// - /// Raw data of arguments. - /// A character that delimits arguments. - /// List of parsed arguments or null value if data is empty or null. - /// If incorrect data. - public Argument[] arguments(string raw, char splitter = ',') - { - if(String.IsNullOrWhiteSpace(raw)) { - return null; - } - return extractArgs(raw, splitter); - } - - /// Initial raw data. - /// To evaluate data with MSBuild engine where it's allowed. - /// Allowed types of evaluation with MSBuild. - public PM(string raw, IMSBuild msbuild = null, EvalType type = EvalType.ArgStringD /*| EvalType.RightOperandStd*/) - : this(msbuild, type) - { - detect(raw); - } - - /// predefined levels. - public PM(List levels) - { - Levels = levels; - } - - /// To evaluate data with MSBuild engine where it's allowed. - /// Allowed types of evaluation with MSBuild. - public PM(IMSBuild msbuild = null, EvalType type = EvalType.ArgStringD) - { - //if(msbuild == null) { - // throw new InvalidArgumentException("PM: The `msbuild` argument cannot be null"); - //} - this.msbuild = msbuild; - teval = type; - } - - /// - /// Entry point of analyser. - /// - /// mixed data - protected void detect(string data) - { - Log.Trace("PM-detect: entered with '{0}'", data); - - StringHandler h = new StringHandler(); - data = h.protectMixedQuotes(data); - - Match m = Rcon.Match(data); - if(!m.Success) { - Levels.Add(getRightOperand(data, h)); - return; - } - - string method = (m.Groups[1].Success)? m.Groups[1].Value : null; - string arguments = (m.Groups[2].Success)? m.Groups[2].Value : null; - string property = (m.Groups[3].Success)? m.Groups[3].Value : null; - string operation = m.Groups[4].Value; - Log.Trace("PM-detect: found '{0}', '{1}', '{2}', '{3}'", property, method, arguments, operation); - - if(property != null) - { - Levels.Add(new Level() { - Type = LevelType.Property, - Data = property, - }); - } - else - { - Levels.Add(new Level() { - Type = LevelType.Method, - Data = method, - Args = extractArgs(h.recovery(arguments)), - }); - } - - detect(h.recovery(operation)); - } - - /// - /// Extracts all arguments from line. - /// - /// Raw line with user arguments. - /// A character that delimits arguments. - /// List of parsed arguments or null value if data is empty. - /// If incorrect arguments line. - protected Argument[] extractArgs(string data, char splitter = ',') - { - if(String.IsNullOrWhiteSpace(data)) { - return new Argument[0]; - } - - StringHandler h = new StringHandler(); - string[] raw = h.protectArguments(data).Split(splitter); - - Argument[] ret = new Argument[raw.Length]; - for(int i = 0; i < raw.Length; ++i) - { - string arg = h.recovery(raw[i]).Trim(); - if(arg.Length < 1 && splitter == ',') { // std: p1, p2, p3 - throw new SyntaxIncorrectException("PM - extractArgs: incorrect arguments line '{0}'", data); - } - ret[i] = detectArgument(arg); - } - return ret; - } - - /// - /// Parse of argument from raw line. - /// - /// - /// Prepared struct. - protected Argument detectArgument(string raw) - { - // Object - { "p1", true, 12 } - - Match m = Regex.Match(raw, String.Format("^{0}$", RPattern.ObjectContent), RegexOptions.IgnorePatternWhitespace); - if(m.Success) - { - return new Argument() { - type = ArgumentType.Object, - data = extractArgs(m.Groups[1].Value.Trim()) - }; - } - - // Char - - m = Regex.Match(raw, String.Format("^{0}$", RPattern.CharContent)); - if(m.Success) - { - return new Argument() { - type = ArgumentType.Char, - data = Value.toChar(m.Groups[1].Value) - }; - } - - - // Strings - - m = Regex.Match(raw, - String.Format(@"^(?: - {0} #1 - Content from double quotes - | - {1} #2 - Content from single quotes - )$", RPattern.DoubleQuotesContent, RPattern.SingleQuotesContent - ), - RegexOptions.IgnorePatternWhitespace); - if(m.Success) - { - if(m.Groups[1].Success) { - return new Argument() { type = ArgumentType.StringDouble, - data = eval(EvalType.ArgStringD, Tokens.unescapeQuotes('"', m.Groups[1].Value)) }; - } - - return new Argument() { type = ArgumentType.StringSingle, - data = eval(EvalType.ArgStringS, Tokens.unescapeQuotes('\'', m.Groups[2].Value)) }; - } - - // Integer - - m = Regex.Match(raw, String.Format("^{0}$", RPattern.IntegerContent)); - if(m.Success) - { - return new Argument() { - type = ArgumentType.Integer, - data = Value.toInt32(m.Groups[1].Value) - }; - } - - // Float - - m = Regex.Match(raw, String.Format("^{0}$", RPattern.FloatContent)); - if(m.Success) - { - return new Argument() { - type = ArgumentType.Float, - data = Value.toFloat(m.Groups[1].Value) - }; - } - - // Double - - m = Regex.Match(raw, String.Format("^{0}$", RPattern.DoubleContent)); - if(m.Success) - { - return new Argument() { - type = ArgumentType.Double, - data = Value.toDouble(m.Groups[1].Value) - }; - } - - // Boolean - - m = Regex.Match(raw, String.Format("^{0}$", RPattern.BooleanContent)); - if(m.Success) - { - return new Argument() { - type = ArgumentType.Boolean, - data = Value.toBoolean(m.Groups[1].Value) - }; - } - - // Enum or Const - - m = Regex.Match(raw, String.Format("^{0}$", RPattern.EnumOrConstContent)); - if(m.Success) - { - return new Argument() { - type = ArgumentType.EnumOrConst, - data = m.Groups[1].Value - }; - } - - // Mixed - - return new Argument() { - type = ArgumentType.Mixed, - data = raw - }; - } - - /// - /// Gets right operand as a Level object. - /// - /// raw data - /// Handler of string if used. - /// - protected ILevel getRightOperand(string data, StringHandler handler = null) - { - if(String.IsNullOrWhiteSpace(data)) { - return new Level() { Type = LevelType.RightOperandEmpty }; - } - - Match m = Regex.Match(data, @"^\s*(=|:)(.*)$", RegexOptions.Singleline); - if(!m.Success) { - throw new SyntaxIncorrectException("PM - getRightOperand: incorrect data '{0}'", data); - } - - string type = m.Groups[1].Value; - string raw = m.Groups[2].Value; - - string ldata = (handler == null)? raw : handler.recovery(raw); - - if(type == ":") { - return new Level() { Type = LevelType.RightOperandColon, Data = eval(EvalType.RightOperandColon, ldata) }; - } - return new Level() { Type = LevelType.RightOperandStd, Data = eval(EvalType.RightOperandStd, ldata) }; - } - - protected string eval(EvalType type, string raw) - { - if(type == EvalType.None || msbuild == null) { - return raw; - } - - return ((teval & type) == type)? msbuild.parse(raw) : raw; - } - - /// - /// Checks last level. - /// - /// Level for checking. - /// true value if selected is latest. - protected bool isLastLevel(ILevel level) - { - switch(level.Type) - { - case LevelType.RightOperandColon: - case LevelType.RightOperandStd: - case LevelType.RightOperandEmpty: { - return true; - } - } - return false; - } - - /// Start position of slicing. - /// - protected List sliceLevels(int level) - { - if(level < 0 || level >= Levels.Count) { - throw new InvalidArgumentException("PM: The level '{0}' should be >= 0 && < Levels({1})", level, Levels.Count); - } - return new List(Levels.Skip(level)); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Script.cs b/vsSolutionBuildEvent/SBEScripts/Script.cs deleted file mode 100644 index 2279e4ec..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Script.cs +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Diagnostics; -using System.Linq; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.SBEScripts -{ - public class Script: ISBEScript, IEvaluator - { - /// - /// Maximum of nesting level - /// - const int DEPTH_LIMIT = 70; - - /// - /// Getting instance of used loader. - /// Default initialization if it still is not used. - /// - public IBootloader Bootloader - { - get - { - if(bootloader == null) - { - Debug.Assert(env != null); - Debug.Assert(uvariable != null); - - bootloader = new Bootloader(env, uvariable); - bootloader.register(); - } - return bootloader; - } - } - protected IBootloader bootloader; - - /// - /// Support of User-variables. - /// - protected IUserVariable uvariable; - - /// - /// Provides operation with environment - /// - protected IEnvironment env; - - /// - /// Flag of post-processing with MSBuild core. - /// In general, some components can require immediate processing with evaluation before passing control to next level. - /// This flag allows processing if needed. - /// - protected bool postMSBuild; - - /// - /// Current level of nesting data. - /// Aborting if reached limit - /// - private volatile int _depthLevel = 0; - - /// - /// object synch. - /// - private Object _lock = new Object(); - - /// - /// Handler of mixed data SBE-Scripts - /// Format: https://bitbucket.org/3F/vssolutionbuildevent/issue/22/#comment-12739932 - /// - /// mixed data - /// Allows post-processing with MSBuild or not. - /// Some components can require immediate processing with evaluation, before passing control to next level. - /// - /// prepared and evaluated data - public string parse(string data, bool allowMSBuild) - { - lock(_lock) - { - _depthLevel = 0; - postMSBuild = allowMSBuild; - StringHandler hString = new StringHandler(); - return hString.recovery(parse(hString.protect(data), _depthLevel, hString)); - } - } - - public string parse(string data) - { - return parse(data, false); - } - - /// - /// Evaluating data with current object - /// - /// mixed data - /// Evaluated end value - public string evaluate(string data) - { - return parse(data); - } - - /// Used environment - /// Used instance of user-variable - public Script(IEnvironment env, IUserVariable uvariable) - { - this.env = env; - this.uvariable = uvariable; - } - - /// Initialization with IBootloader - public Script(IBootloader loader) - { - bootloader = loader; - env = loader.Env; - uvariable = loader.UVariable; - } - - /// Mixed data - /// Nesting level - /// Handler of strings if exists - /// Prepared and evaluated data - protected string parse(string data, int level, StringHandler hString = null) - { - if(level >= DEPTH_LIMIT) { - _depthLevel = 0; - throw new LimitException("Nesting level of '{0}' reached. Aborted.", DEPTH_LIMIT); - } - var rcon = RPattern.Container; - - return rcon.Replace(data, - delegate(Match m) - { - string escape = m.Groups[1].Value; - string raw = m.Groups[2].Value; - - if(escape.Length > 1) { - Log.Trace("SBEScripts-Container: escape `{0}`", (raw.Length > 40)? raw.Substring(0, 40) + "..." : raw); - return "#" + escapeMSBuildData(raw, true); - } - - return selector((hString != null)? hString.recovery(raw) : raw); - }); - } - - /// - /// Parse data for specific component - /// - /// Mixed data - /// Component - /// Prepared + evaluated data by component - protected string parse(string data, IComponent c) - { - string ret = c.parse(data); - - if(c.PostParse) - { - ++_depthLevel; - ret = parse(ret, _depthLevel); - --_depthLevel; - } - return ret; - } - - /// - /// only $(..) -> $$(..) if false / and $$(..) -> $$$(..), etc. if true - /// - protected virtual string escapeMSBuildData(string data, bool force) - { - string pattern = String.Format(@"{0}{1}", - (force)? String.Empty : @"(? - /// Checking ability to parse the data for specific component - /// - /// Mixed data - /// Component - /// ready to parse or not - protected bool isReadyToParse(string data, IComponent c) - { - if(!c.CRegex) { - return data.StartsWith(String.Format("[{0}", c.Condition)); - } - return Regex.IsMatch(data, String.Format("^\\[{0}", c.Condition), RegexOptions.IgnorePatternWhitespace); - } - - /// mixed data - /// prepared and evaluated data - protected string selector(string data) - { - Log.Trace("Selector: started with `{0}`", data); - - foreach(IComponent c in Bootloader.Components) - { - c.PostProcessingMSBuild = postMSBuild; - - if(!c.BeforeDeepen) { - continue; - } - - if(isReadyToParse(data, c)) { - return parse(data, c); - } - } - - if(deepen(ref data)) { - ++_depthLevel; - data = parse(data, _depthLevel); - --_depthLevel; - } - - foreach(IComponent c in Bootloader.Components) - { - if(c.BeforeDeepen) { - continue; // should already parsed above - } - - if(isReadyToParse(data, c)) { - return parse(data, c); - } - } - - throw new SelectorMismatchException("Selector: cannot find component. {0}/{1} :: `{2}`", - Bootloader.Components.Count(), - Bootloader.Registered.Count(), - data); - } - - protected bool deepen(ref string data) - { - return RPattern.Container.IsMatch(data); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/StringHandler.cs b/vsSolutionBuildEvent/SBEScripts/StringHandler.cs deleted file mode 100644 index c6e80ccd..00000000 --- a/vsSolutionBuildEvent/SBEScripts/StringHandler.cs +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Text.RegularExpressions; - -namespace net.r_eg.vsSBE.SBEScripts -{ - public class StringHandler: Scripts.StringProtector - { - /// - /// Specific format of double quotes with content - /// - public override string DoubleQuotesContentFull - { - get { return RPattern.DoubleQuotesContentFull; } - } - - /// - /// Specific format of single quotes with content - /// - public override string SingleQuotesContentFull - { - get { return RPattern.SingleQuotesContentFull; } - } - - /// - /// Protects the MSBuild/SBE-Scripts containers. - /// - /// - /// protected string - public string protectCores(string data) - { - lock(_lock) - { - return Regex.Replace(data, - String.Format(@"({0}|{1})", // #1 - mixed - @"\#{1,2}" + RPattern.SquareBracketsContent, // #2 - #[..] - @"\${1,2}" + RPattern.RoundBracketsContent // #3 - $(..) - ), - replacerIn, - RegexOptions.IgnorePatternWhitespace); - } - } - - /// - /// Protects ArrayContent data. - /// - /// - /// protected string - public string protectArray(string data) - { - return protectByPattern(data, String.Format("({0})", RPattern.ObjectContent)); - } - - /// - /// Protects argument list. - /// - /// - /// protected string - public string protectArguments(string data) - { - return protectArray(protectMixedQuotes(data)); - } - - /// - /// Protects data inside <#data> ... </#data> - /// - /// - /// - public string protectDataSection(string data) - { - // <#data> ... - lock (_lock) { - return Regex.Replace(data, @"<#data>(.*?)<\/#data>", replacerIn, RegexOptions.Singleline); - } - } - - /// - /// Protection methods by default. - /// - /// - /// - public string protect(string data) - { - return protectMixedQuotes(protectDataSection(data)); - } - - /// - /// Escaping quotes in data - /// - /// mixed string - /// data with escaped quotes - public static string escapeQuotes(string data) - { - if(String.IsNullOrEmpty(data)) { - return String.Empty; - } - // (? - /// Unescape quote symbols from string. - /// TODO - /// - /// Quote symbol. - /// - /// String with unescaped quote symbols. - public static string unescapeQuotes(char type, string data) - { - return Scripts.Tokens.unescapeQuotes(type, data); - } - - /// - /// Normalize data for strings. - /// e.g.: unescape double quotes etc. - /// TODO: obsolete - /// - /// - /// - public static string normalize(string data) - { - if(String.IsNullOrEmpty(data)) { - return String.Empty; - } - return unescapeQuotes('"', data); - } - } -} diff --git a/vsSolutionBuildEvent/SBEScripts/Value.cs b/vsSolutionBuildEvent/SBEScripts/Value.cs deleted file mode 100644 index f8af9b31..00000000 --- a/vsSolutionBuildEvent/SBEScripts/Value.cs +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using System.Globalization; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.Extensions; - -namespace net.r_eg.vsSBE.SBEScripts -{ - /// - /// TODO: specification for SBE-Script - /// - public static class Value - { - public const string VTRUE = "true"; - public const string VFALSE = "false"; - - /// - /// Separator for array data. - /// - public const string ARRAY_SEPARATOR = ","; - - /// - /// Empty value by default. - /// - public static string Empty - { - get { return String.Empty; } - } - - /// - /// Getting boolean value - /// Boolean.Parse() - converts only true/false value from string - /// - /// - /// - public static bool toBoolean(string val) - { - val = val.Trim();//.ToLower(); - switch(val) { - case "1": - case "True": - case "TRUE": - case VTRUE: { - return true; - } - case "0": - case "False": - case "FALSE": - case VFALSE: { - return false; - } - } - throw new IncorrectSyntaxException("Values: incorrect boolean value - '{0}'", val); - } - - /// - /// Getting Int32 value - /// - /// - /// - public static int toInt32(string val) - { - return Int32.Parse(val.Trim()); - } - - /// - /// Getting Unsigned Int32 value - /// - /// - /// - public static uint toUInt32(string val) - { - return UInt32.Parse(val.Trim()); - } - - /// - /// Getting of floating-point number with single-precision. - /// - /// - /// - public static float toFloat(string val) - { - return Single.Parse(val.Trim(), CultureInfo.InvariantCulture); - } - - /// - /// Getting of floating-point number with double-precision. - /// - /// - /// - public static double toDouble(string val) - { - return Double.Parse(val.Trim(), CultureInfo.InvariantCulture); - } - - /// - /// Getting of symbol as char. - /// - /// - /// - public static char toChar(string val) - { - return Char.Parse(val.Trim()); - } - - /// - /// - public static string from(bool val) - { - return val.ToString().ToLower(); - } - - /// - /// - public static string from(List val) - { - return String.Join(ARRAY_SEPARATOR, val); - } - - /// - /// - public static string from(int val) - { - return val.ToString(); - } - - /// - /// - public static string from(Enum val) - { - return val.ToString(); - } - - /// Including array of data - /// - public static string from(object val) - { - if(val == null) { - return String.Empty; - } - - if(val.GetType().IsArray) { - string[] arr = Array.ConvertAll((object[])val, i => i.ToString()); - return String.Join(ARRAY_SEPARATOR, arr); - } - return val.ToString(); - } - - /// - /// - public static string from(string val) - { - return (val)?? String.Empty; - } - - /// - /// Extract SNode.Argument[] into system object[] data. - /// - /// SNode arguments. - /// - public static object[] extract(SNode.Argument[] args) - { - object[] ret = new object[args.Length]; - for(int i = 0; i < args.Length; ++i) - { - if(args[i].data is SNode.Argument[]) { - ret[i] = extract((SNode.Argument[])args[i].data); - continue; - } - ret[i] = args[i].data; -#if DEBUG - Log.Trace("Value.extract: SNode.Argument - '{0}'", ret[i]); -#endif - } - return ret; - } - - /// - /// To pack complex object data in string format. - /// Ex.: {"str", 123, -1.4, true, "str2", {1.2, "str2", false}, -24.574} - /// - /// Mixed data inc. complex object. - /// string with mixed data. - public static string pack(object data) - { - if(data == null) { - return null; - } - data = data.ToSystemObject(); - - if(!data.GetType().IsArray) { - return data.ToString(); - } - List ret = new List(); - - foreach(object val in (object[])data) - { - object sys = val.ToSystemObject(); - - if(sys.GetType().IsArray) { - ret.Add(pack(sys)); - continue; - } - - if(sys is string) { - ret.Add(String.Format("\"{0}\"", sys)); - continue; - } - - if(sys is bool) { - ret.Add(sys.ToString().ToLower()); - continue; - } - - if(sys is char) { - ret.Add(String.Format("'{0}'", sys)); - continue; - } - - if(sys is Single) { - ret.Add(String.Format("{0}f", sys.ToString().Replace(',', '.'))); - continue; - } - - if(sys is Double) { - ret.Add(sys.ToString().Replace(',', '.')); - continue; - } - - ret.Add(sys); - } - return String.Format("{{{0}}}", String.Join(", ", ret)); - } - - /// - /// To pack string argument in object. - /// - /// Argument for packing. - /// - public static object packArgument(object arg) - { - if(arg == null) { - return null; - } - - if(!(arg is string) || String.IsNullOrWhiteSpace((string)arg)) { - return arg; - } - - SNode.IPM pm = new SNode.PM(String.Format("_({0})", arg)); - SNode.Argument first = pm.FirstLevel.Args[0]; - - if(first.type != SNode.ArgumentType.Object) { - return arg; - } - return extract((SNode.Argument[])first.data); - } - - /// - /// Comparing values - /// - /// Left operand - /// Right operand - /// Operator of comparison - /// Result of comparison - public static bool cmp(string left, string right = VTRUE, string coperator = "===") - { - switch(coperator) - { - case "===": { - return (left == right); - } - case "!==": { - return (left != right); - } - case "~=": { - return (left.Contains(right)); - } - case "==": { - return isEqual(left, right); - } - case "!=": { - return !isEqual(left, right); - } - case "^=": { - return left.StartsWith(right); - } - case "=^": { - return left.EndsWith(right); - } - case ">": { - return (toInt32(left) > toInt32(right)); - } - case ">=": { - return (toInt32(left) >= toInt32(right)); - } - case "<": { - return (toInt32(left) < toInt32(right)); - } - case "<=": { - return (toInt32(left) <= toInt32(right)); - } - } - throw new IncorrectSyntaxException("Values-comparison: incorrect operator - '{0}'", coperator); - } - - /// - /// Comparing values by chain: Int32 -> Boolean -> String - /// - /// left operand - /// right operand - /// - private static bool isEqual(string left, string right) - { - int lNumber, rNumber; - if(Int32.TryParse(left, out lNumber) && Int32.TryParse(right, out rNumber)) { - Log.Trace("Values-isEqual: as numeric '{0}' == '{1}'", left, right); - return (lNumber == rNumber); - } - - try { - bool ret = (toBoolean(left) == toBoolean(right)); - Log.Trace("Values-isEqual: as boolean '{0}' == '{1}'", left, right); - return ret; - } - catch(IncorrectSyntaxException) { - Log.Trace("Values-isEqual: as string '{0}' == '{1}'", left, right); - } - return (left == right); - } - } -} diff --git a/vsSolutionBuildEvent/Scripts/EvaluatorBlank.cs b/vsSolutionBuildEvent/Scripts/EvaluatorBlank.cs deleted file mode 100644 index 0a867def..00000000 --- a/vsSolutionBuildEvent/Scripts/EvaluatorBlank.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.Scripts -{ - public class EvaluatorBlank: IEvaluator - { - /// - /// Entry point for evaluation - /// - /// mixed data - /// Evaluated end value - public string evaluate(string data) - { - return data; - } - } -} diff --git a/vsSolutionBuildEvent/Scripts/IEvaluator.cs b/vsSolutionBuildEvent/Scripts/IEvaluator.cs deleted file mode 100644 index f639e8ae..00000000 --- a/vsSolutionBuildEvent/Scripts/IEvaluator.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.Scripts -{ - /// - /// Specification of the evaluation for different data - /// - public interface IEvaluator - { - /// - /// Entry point for some evaluation - /// - /// mixed data - /// Evaluated end value - string evaluate(string data); - } -} diff --git a/vsSolutionBuildEvent/Scripts/IUserVariable.cs b/vsSolutionBuildEvent/Scripts/IUserVariable.cs deleted file mode 100644 index 4f6c63ae..00000000 --- a/vsSolutionBuildEvent/Scripts/IUserVariable.cs +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System.Collections.Generic; - -namespace net.r_eg.vsSBE.Scripts -{ - public interface IUserVariable - { - /// - /// Exposes the enumerable for defined names of user-variables - /// - IEnumerable Definitions { get; } - - /// - /// Exposes the enumerable for defined user-variables - /// - IEnumerable Variables { get; } - - /// - /// Getting value of user-variable by using scope of project - /// - /// variable name - /// project name - /// evaluated value of variable - string get(string name, string project); - - /// - /// Getting value of user-variable by using unique identification - /// - /// Unique identificator - /// Evaluated value of variable - string get(string ident); - - /// - /// Get user-variable struct by using scope of project - /// - /// variable name - /// project name - /// Struct of user-variable - TUserVariable getVariable(string name, string project); - - /// - /// Get user-variable struct by using unique identification - /// - /// Unique identificator - /// Struct of user-variable - TUserVariable getVariable(string ident); - - /// - /// Defines user-variable - /// Value setted as unevaluated - /// - /// variable name - /// project name - /// mixed string with unevaluated data - void set(string name, string project, string unevaluated); - - /// - /// Evaluation user-variable with IEvaluator by using scope of project - /// Evaluated value should be updated for variable. - /// - /// Variable name for evaluating - /// Project name - /// IEvaluator objects for evaluating - /// Evaluation can be in the chain of others IEvaluator's, this flag should reset this to initial state - void evaluate(string name, string project, IEvaluator evaluator, bool resetting); - - /// - /// Evaluation user-variable with IEvaluator by using unique identification - /// Evaluated value should be updated for variable. - /// - /// Unique identificator - /// IEvaluator objects for evaluating - /// Evaluation can be in the chain of others IEvaluator's, this flag should reset this to initial state - void evaluate(string ident, IEvaluator evaluator, bool resetting); - - /// - /// Checking for variable - completed evaluation or not - /// by using scope of project - /// - /// Variable name - /// Project name - /// - bool isUnevaluated(string name, string project); - - /// - /// Checking for variable - completed evaluation or not - /// by using unique identification - /// - /// Unique identificator - /// - bool isUnevaluated(string ident); - - /// - /// Checking existence of variable - /// by using scope of project - /// - /// Variable name - /// Project name - /// - bool isExist(string name, string project); - - /// - /// Checking existence of variable - /// by using unique identification - /// - /// Unique identificator - /// - bool isExist(string ident); - - /// - /// Removes user-variable - /// by using scope of project - /// - /// variable name - /// project name - void unset(string name, string project); - - /// - /// Removes user-variable - /// by using unique identification - /// - /// Unique identificator - void unset(string ident); - - /// - /// Removes all user-variables - /// - void unsetAll(); - } -} diff --git a/vsSolutionBuildEvent/Scripts/IUserVariableDebug.cs b/vsSolutionBuildEvent/Scripts/IUserVariableDebug.cs deleted file mode 100644 index 7f9dcd15..00000000 --- a/vsSolutionBuildEvent/Scripts/IUserVariableDebug.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.Scripts -{ - /// - /// Debugging and complex support the IUserVariable - /// - public interface IUserVariableDebug - { - /// - /// Re/Defines user-variable with evaluated value. - /// - /// Unique identificator - /// mixed string with evaluated data - void debSetEvaluated(string ident, string evaluated); - } -} diff --git a/vsSolutionBuildEvent/Scripts/StringProtector.cs b/vsSolutionBuildEvent/Scripts/StringProtector.cs deleted file mode 100644 index 74845795..00000000 --- a/vsSolutionBuildEvent/Scripts/StringProtector.cs +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Concurrent; -using System.Diagnostics; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.Scripts -{ - /// - /// This variant is based on storing of tokens inside string. - /// It's simply, but we have a some problems (like with guid) and other inconvenience from final strings. - /// As alternative for this, we should implement the nodes storing (like SNode) to abstract build of all final strings by tokens etc. Well, currently we're simple :) - /// - public abstract class StringProtector - { - /// - /// Maximum of nesting level to recovery operation - /// - public const int RECOVERY_LIMIT = 50; - - /// - /// Storage of protected strings - /// Contains the all protected strings for recovery operations. - /// - protected ConcurrentDictionary strings = new ConcurrentDictionary(); - - /// - /// object synch. - /// - protected Object _lock = new Object(); - - /// - /// Current level of nesting recovery operation. - /// Aborting if reached limit - /// - private volatile uint _recoveryLevel; - - /// - /// Unsigned identifier of tokens. - /// - private volatile uint _ident = 0; - - /// - /// Unique identifier between all protectors. - /// TODO - /// - private static uint guid = 0; - - /// - /// Specific format of double quotes with content - /// - public abstract string DoubleQuotesContentFull { get; } - - /// - /// Specific format of single quotes with content - /// - public abstract string SingleQuotesContentFull { get; } - - /// - /// Unique identifier for current protector. - /// - public uint UID - { - get; - protected set; - } - - /// - /// Generates and returns the next ident number - /// - protected uint IdentNext - { - get { return ++_ident; } - } - - /// - /// Get current ident number - /// - protected uint Ident - { - get { return _ident; } - } - - /// - /// Protects data inside mixed quotes. - /// - /// - /// protected string - public string protectMixedQuotes(string data) - { - return protectQuotes(ref data, String.Format(@"({0}|{1})", // #1 - mixed - DoubleQuotesContentFull, // #2 - ".." - SingleQuotesContentFull)); // #3 - '..' - } - - /// - /// Protects data inside single quotes. - /// - /// - /// protected string - public string protectSingleQuotes(string data) - { - return protectQuotes(ref data, SingleQuotesContentFull); - } - - /// - /// Protects data inside double quotes. - /// - /// - /// protected string - public string protectDoubleQuotes(string data) - { - return protectQuotes(ref data, DoubleQuotesContentFull); - } - - /// - /// Protects data with custom pattern. - /// - /// - /// Pattern with first ($1) capture group. - /// protected string - public string protectByPattern(string data, string pattern) - { - lock(_lock) { - return Regex.Replace(data, pattern, replacerIn, RegexOptions.IgnorePatternWhitespace); - } - } - - /// - /// Restores the all protected data for strings. - /// - /// - /// - public string recovery(string data) - { - Debug.Assert(strings != null); - - if(_recoveryLevel >= RECOVERY_LIMIT) { - _recoveryLevel = 0; - throw new LimitException("StringProtector->recovery: Nesting level of '{0}' reached. Aborted.", RECOVERY_LIMIT); - } - - string format = replacementOut(); - lock(_lock) - { - string ret = Regex.Replace(data, format, delegate(Match m) - { - string removed; - uint index = unpackId(m.Groups[1].Value); - strings.TryRemove(index, out removed); // deallocate protected string -#if DEBUG - Log.Trace("StringProtector: recovery string '{0}' :: '{1}' /level: {2}", removed, index, _recoveryLevel); -#endif - return removed; - }); - - if(Regex.IsMatch(ret, format)) - { -#if DEBUG - Log.Trace("StringProtector->recovery: found the new protected data - '{0}'", ret); -#endif - ++_recoveryLevel; - ret = recovery(ret); - --_recoveryLevel; - } - return ret; - } - } - - /// - /// Flushes internal storage for protected strings - /// - public void flush() - { - strings.Clear(); - _ident = 0; - } - - protected StringProtector() - { - lock (_lock) { - gcollect(); - UID = guid++; - } - } - - protected void gcollect() - { - //TODO: - if(guid == uint.MaxValue) { - Log.Debug("gcollect: reset id"); - guid = 0; - } - } - - /// - /// Protects data inside quotes by format. - /// - /// - /// type/s of quotes - /// protected string - protected string protectQuotes(ref string data, string format) - { - lock(_lock) { - return Regex.Replace(data, format, replacerIn, RegexOptions.IgnorePatternWhitespace); - } - } - - /// - /// Replacer by default for protection inside strings. - /// - /// - /// string with changed data - protected string replacerIn(Match m) - { - uint ident = IdentNext; - strings[ident] = m.Groups[1].Value; -#if DEBUG - Log.Trace("StringProtector: protect `{0}` :: '{1}'", strings[ident], ident); -#endif - return replacementIn(ident); - } - - /// - /// How to protect data. - /// - /// Unique identificator - /// - protected string replacementIn(uint ident) - { - return replacementFormat(packId(ident)); - } - - /// - /// How to recover data from strings. - /// - /// - protected string replacementOut() - { - return replacementFormat(formatId()); - } - - /// - /// Format of protection. - /// - /// - /// - protected virtual string replacementFormat(string format) - { - // no conflict, because all variants with '!' as argument is not possible without quotes. - return String.Format("!{0}@{1}!", packId(UID), format); - } - - protected virtual string packId(uint id) - { - return id.ToString("x"); - } - - protected virtual uint unpackId(string id) - { - return Convert.ToUInt32(id, 16); - } - - protected virtual string formatId() - { - return "([0-9a-f]+)"; - } - } -} \ No newline at end of file diff --git a/vsSolutionBuildEvent/Scripts/TUserVariable.cs b/vsSolutionBuildEvent/Scripts/TUserVariable.cs deleted file mode 100644 index a713bacb..00000000 --- a/vsSolutionBuildEvent/Scripts/TUserVariable.cs +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -namespace net.r_eg.vsSBE.Scripts -{ - public struct TUserVariable - { - /// - /// Contains the evaluated data or escaped variable/property (without escape symbol) - /// Using from current the unevaluated field - /// - public string evaluated; - - /// - /// Contains the unevaluated mixed data - /// May contain the another user-variable etc. - /// - public string unevaluated; - - /// - /// Identifier of current variable - /// - public string ident; - - /// - /// Front-end variable name if used - /// - public string name; - - /// - /// Context of variable if used - /// - public string project; - - /// - /// Current status of evaluation - /// - public StatusType status; - - /// - /// Previous TUserVariable if exist. - /// This probably can be used for self redefinition varname = varname - /// e.g. for post-processing with MSBuild is required to evaluation of new value etc. - /// - public object prev; - - /// - /// Storing in the projects files ~ .csproj, .vcxproj, .. - /// or with the external containers - /// - /// reserved - public bool persistence; - - /// - /// Available states of evaluating - /// - public enum StatusType - { - /// - /// Stored 'as is' - /// - Unevaluated, - /// - /// Evaluation in progress - /// - Started, - /// - /// End value - /// - Evaluated - } - - public TUserVariable(TUserVariable origin) - : this() - { - evaluated = origin.evaluated; - unevaluated = origin.unevaluated; - ident = origin.ident; - name = origin.name; - project = origin.project; - status = origin.status; - persistence = origin.persistence; - prev = origin.prev; - } - } -} diff --git a/vsSolutionBuildEvent/Scripts/Tokens.cs b/vsSolutionBuildEvent/Scripts/Tokens.cs deleted file mode 100644 index a899e3c8..00000000 --- a/vsSolutionBuildEvent/Scripts/Tokens.cs +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.Scripts -{ - public static class Tokens - { - /// - /// Handler of the escape-sequence. - /// - /// hexadecimal-escape-sequence: - /// \x 0-0xF [0-0xF [0-0xF [0-0xF]]] - /// https://msdn.microsoft.com/en-us/library/aa691087%28v=vs.71%29.aspx - /// - /// unicode-escape-sequence: - /// \u 0-0xF 0-0xF 0-0xF 0-0xF - /// \U 0-0xF 0-0xF 0-0xF 0-0xF 0-0xF 0-0xF 0-0xF 0-0xF - /// https://msdn.microsoft.com/en-us/library/aa664669%28v=vs.71%29.aspx - /// - /// - /// a limited set of combinations if true - /// - public static string characters(string data, bool limited = true) - { - if(String.IsNullOrEmpty(data)) { - return String.Empty; - } - string ret; - - if(!limited) { - // https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.unescape.aspx - ret = Regex.Unescape(data); //inc.: \, *, +, ?, |, {, }, [, ], (,), ^, $,., #, and white space characters - Log.Trace("Tokens: processed characters '{0}'", ret); - return ret; - } - - ret = Regex.Replace(data, String.Format(@"(\\){{1,2}} - (?: - r|n|t|v|a|b|0|f - |x{0}{{1,4}} - |u{0}{{4}} - |U{0}{{8}} - )", "[A-Fa-f0-9]"), - delegate(Match m) - { - if(m.Groups[1].Value.Length > 1) { - return m.Value.Substring(1); - } - return Regex.Unescape(m.Value); - }, - RegexOptions.IgnorePatternWhitespace); - - Log.Trace("Tokens: limited processed characters '{0}'", ret); - return ret; - } - - /// - /// Unescape quote symbols from string. - /// - /// Quote symbol. - /// - /// String with unescaped quote symbols. - public static string unescapeQuotes(char type, string data) - { - if(String.IsNullOrWhiteSpace(data)) { - return String.Empty; - } - - switch(type) - { - case '\'': - case '"': { - return data.Replace("\\" + type, type.ToString()); - } - } - - throw new NotSupportedOperationException("The quote symbol ({0}) is not supported.", type); - } - } -} diff --git a/vsSolutionBuildEvent/Scripts/UserVariable.cs b/vsSolutionBuildEvent/Scripts/UserVariable.cs deleted file mode 100644 index f37c4753..00000000 --- a/vsSolutionBuildEvent/Scripts/UserVariable.cs +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . -*/ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.RegularExpressions; -using net.r_eg.vsSBE.Exceptions; - -namespace net.r_eg.vsSBE.Scripts -{ - public class UserVariable: IUserVariable, IUserVariableDebug - { - /// - /// Contains all defined user-variables. - /// - /// Note: ConcurrentDictionary used Nodes! order is unpredictable - see m_tables and internal adding - /// http://referencesource.microsoft.com/#mscorlib/system/Collections/Concurrent/ConcurrentDictionary.cs - /// https://bitbucket.org/3F/vssolutionbuildevent/commits/34cdc43df67#comment-1330734 - /// - /// Also variant use the both SynchronizedCollection/BlockingCollection + ConcurrentDictionary for O(1) operations - /// - protected Dictionary definitions = new Dictionary(); - - /// - /// object synch. - /// - private Object _lock = new Object(); - - /// - /// Exposes the enumerable for defined names of user-variables - /// - public IEnumerable Definitions - { - get { - foreach(KeyValuePair def in definitions.ToArray()) { - yield return def.Key; - } - } - } - - /// - /// Exposes the enumerable for defined user-variables - /// - public IEnumerable Variables - { - get { - foreach(KeyValuePair def in definitions.ToArray()) { - yield return def.Value; - } - } - } - - /// - /// Getting value of user-variable by using scope of project - /// - /// variable name - /// project name - /// evaluated value of variable or null if variable not defined - public string get(string name, string project) - { - return get(defIndex(name, project)); - } - - /// - /// Getting value of user-variable by using unique identification - /// - /// Unique identificator - /// Evaluated value of variable - public string get(string ident) - { - lock(_lock) - { - if(!definitions.ContainsKey(ident)) { - return null; - } - string evaluated = definitions[ident].evaluated; - - if(evaluated == null) { - Log.Debug("getValue: evaluated value of '{0}' is null", ident); - evaluated = String.Empty; - } - return evaluated; - } - } - - /// - /// Get user-variable struct by using scope of project - /// - /// variable name - /// project name - /// Struct of user-variable - public TUserVariable getVariable(string name, string project) - { - return getVariable(defIndex(name, project)); - } - - /// - /// Get user-variable struct by using unique identification - /// - /// Unique identificator - /// Struct of user-variable - public TUserVariable getVariable(string ident) - { - lock(_lock) - { - if(definitions.ContainsKey(ident)) { - return definitions[ident]; - } - return default(TUserVariable); - } - } - - /// - /// Defines user-variable - /// Value setted as unevaluated - /// - /// variable name - /// project name or null if project is default - /// mixed string. Converted to empty string if value is null - public void set(string name, string project, string unevaluated) - { - if(!isValidName(name) || !isValidProject(project)) { - throw new InvalidArgumentException("name - '{0}' or project - '{1}' is not valid for variable", name, project); - } - string defindex = defIndex(name, project); - - if(unevaluated == null) { - unevaluated = String.Empty; - } - - lock(_lock) - { - definitions[defindex] = new TUserVariable() { - unevaluated = unevaluated, - ident = defindex, - name = name, - project = project, - status = TUserVariable.StatusType.Unevaluated, - prev = (definitions.ContainsKey(defindex))? definitions[defindex] : new TUserVariable(), - evaluated = null - }; - Log.Debug("User-variable: defined '{0}' = '{1}'", defindex, unevaluated); - } - } - - /// - /// Evaluation user-variable with IEvaluator by using scope of project - /// Evaluated value should be updated for variable. - /// - /// Variable name for evaluating - /// Project name - /// IEvaluator objects for evaluating - /// Evaluating from the unevaluated data if true, otherwise evaluation in the chain of others IEvaluator's - public void evaluate(string name, string project, IEvaluator evaluator, bool resetting) - { - evaluate(defIndex(name, project), evaluator, resetting); - } - - /// - /// Evaluation user-variable with IEvaluator by using unique identification - /// Evaluated value should be updated for variable. - /// - /// Unique identificator - /// IEvaluator objects for evaluating - /// Evaluating from the unevaluated data if true, otherwise evaluation in the chain of others IEvaluator's - public void evaluate(string ident, IEvaluator evaluator, bool resetting) - { - lock(_lock) - { - if(!definitions.ContainsKey(ident)) { - throw new NotFoundException("Variable '{0}' is not found.", ident); - } - - if(evaluator == null) { - throw new InvalidArgumentException("Evaluation of variable: evaluator is null"); - } - - TUserVariable var = new TUserVariable(definitions[ident]) { - status = TUserVariable.StatusType.Started - }; - definitions[ident] = var; - - if(resetting) { - var.evaluated = evaluator.evaluate(var.unevaluated); - } - else { - var.evaluated = evaluator.evaluate(var.evaluated); - } - var.status = TUserVariable.StatusType.Evaluated; - definitions[ident] = var; - Log.Trace("IEvaluator '{0}': Evaluation of variable '{1}' is completed.", evaluator.GetType().ToString(), ident); - } - } - - /// - /// Checking for variable - completed evaluation or not - /// by using scope of project - /// - /// Variable name - /// Project name - /// - public bool isUnevaluated(string name, string project) - { - return isUnevaluated(defIndex(name, project)); - } - - /// - /// Checking for variable - completed evaluation or not - /// by using unique identification - /// - /// Unique identificator - /// - public bool isUnevaluated(string ident) - { - return (definitions[ident].status == TUserVariable.StatusType.Unevaluated); - } - - /// - /// Checking existence of variable - /// by using scope of project - /// - /// Variable name - /// Project name - /// - public bool isExist(string name, string project) - { - return isExist(defIndex(name, project)); - } - - /// - /// Checking existence of variable - /// by using unique identification - /// - /// Unique identificator - /// - public bool isExist(string ident) - { - return definitions.ContainsKey(ident); - } - - /// - /// Validation of variable name - /// - /// variable name - /// Is valid or not - public virtual bool isValidName(string name) - { - if(String.IsNullOrEmpty(name)) { - return false; - } - return Regex.Match(name, "^[a-z_][a-z_0-9]*$", RegexOptions.IgnoreCase).Success; - } - - /// - /// Validation of project name - /// - /// project name - /// Is valid or not - public virtual bool isValidProject(string project) - { - if(String.IsNullOrEmpty(project)) { - return true; - } - //TODO: - return true; - } - - /// - /// Remove user-variable - /// by using scope of project - /// - /// variable name - /// project name - /// key is null - public void unset(string name, string project) - { - unset(defIndex(name, project)); - } - - /// - /// Removes user-variable - /// by using unique identification - /// - /// Unique identificator - public void unset(string ident) - { - lock(_lock) - { - if(definitions.Remove(ident)) { - Log.Debug("User-variable is successfully unset '{0}'", ident); - return; - } - } - Log.Debug("Cannot unset the user-variable '{0}'", ident); - } - - /// - /// Remove all user-variables - /// - public void unsetAll() - { - lock(_lock) { - definitions.Clear(); - } - Log.Trace("Reseted all User-variables"); - } - - /// - /// Re/Defines user-variable with evaluated value. - /// - /// Unique identificator - /// mixed string with evaluated data - public void debSetEvaluated(string ident, string evaluated) - { - if(evaluated == null) { - evaluated = String.Empty; - } - - lock(_lock) - { - definitions[ident] = new TUserVariable() { - unevaluated = evaluated, - ident = ident, - status = TUserVariable.StatusType.Evaluated, - prev = (definitions.ContainsKey(ident))? definitions[ident] : new TUserVariable(), - evaluated = evaluated - }; - Log.Debug("User-variable(Debug service): updated '{0}' with evaluated value '{1}'", ident, evaluated); - } - } - - /// - /// Used key-index for definitions - /// - protected string defIndex(string name, string project) - { - if(String.IsNullOrEmpty(project)) { - return name; - } - return String.Format("{0}_{1}", name, project); - } - } -} diff --git a/vsSolutionBuildEvent/Settings.cs b/vsSolutionBuildEvent/Settings.cs index 6c75dcf6..57874bc7 100644 --- a/vsSolutionBuildEvent/Settings.cs +++ b/vsSolutionBuildEvent/Settings.cs @@ -18,8 +18,8 @@ using System; using System.IO; using System.Reflection; +using net.r_eg.MvsSln.Extensions; using net.r_eg.vsSBE.Configuration; -using net.r_eg.vsSBE.Extensions; using IUserData = net.r_eg.vsSBE.Configuration.User.IData; namespace net.r_eg.vsSBE @@ -47,6 +47,11 @@ internal sealed class Settings: IAppSettings /// public event EventHandler> DebugModeUpdated = delegate(object sender, DataArgs e) { }; + /// + /// When IAppSettings.WorkPath was updated. + /// + public event EventHandler> WorkPathUpdated = delegate (object sender, DataArgs e) { }; + /// /// Debug mode for application. /// @@ -95,7 +100,7 @@ public string CommonPath } string vsdir = System.Environment.GetEnvironmentVariable("VisualStudioDir"); - string path = Path.Combine((vsdir)?? Path.GetTempPath(), APP_NAME).PathFormat(); + string path = Path.Combine((vsdir)?? Path.GetTempPath(), APP_NAME).DirectoryPathFormat(); if(!Directory.Exists(path)) { Directory.CreateDirectory(path); @@ -114,7 +119,7 @@ public string LibPath get { if(String.IsNullOrWhiteSpace(libPath)) { - libPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location).PathFormat(); + libPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location).DirectoryPathFormat(); } return libPath; } @@ -129,7 +134,7 @@ public string WorkPath get { if(String.IsNullOrWhiteSpace(workPath)) { - workPath = "".PathFormat(); + workPath = "".DirectoryPathFormat(); Log.Trace("WorkPath is empty or null, use `{0}` by default.", workPath); //throw new SBEException("WorkPath is empty or null"); } @@ -141,12 +146,7 @@ public string WorkPath /// /// OWP item name by default. /// - public string DefaultOWPItem - { - get { return defaultOWPItem; } - set { defaultOWPItem = value; } - } - private string defaultOWPItem = "Build"; + public string DefaultOWPItem => "Build"; /// /// Manager of configurations. @@ -260,7 +260,8 @@ public static string LPath /// New path. public void setWorkPath(string path) { - workPath = path.PathFormat(); + workPath = path.DirectoryPathFormat(); + WorkPathUpdated(this, new DataArgs() { Data = workPath }); } /// diff --git a/vsSolutionBuildEvent/SBEScripts/Components/InternalComponent.cs b/vsSolutionBuildEvent/SobaScript/Components/InternalComponent.cs similarity index 62% rename from vsSolutionBuildEvent/SBEScripts/Components/InternalComponent.cs rename to vsSolutionBuildEvent/SobaScript/Components/InternalComponent.cs index d19e41b4..799728b1 100644 --- a/vsSolutionBuildEvent/SBEScripts/Components/InternalComponent.cs +++ b/vsSolutionBuildEvent/SobaScript/Components/InternalComponent.cs @@ -16,67 +16,59 @@ */ using System; +using net.r_eg.SobaScript; +using net.r_eg.SobaScript.Components; +using net.r_eg.SobaScript.Exceptions; +using net.r_eg.SobaScript.Mapper; +using net.r_eg.SobaScript.SNode; +using net.r_eg.SobaScript.Z.Ext.IO; using net.r_eg.vsSBE.Actions; using net.r_eg.vsSBE.Bridge; using net.r_eg.vsSBE.Events; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; -namespace net.r_eg.vsSBE.SBEScripts.Components +namespace net.r_eg.vsSBE.SobaScript.Components { /// - /// All internal operations with vsSBE + /// Internal operations with vsSBE. /// - [Component("vsSBE", new string[] { "Core" }, "All internal operations with vsSBE")] - public class InternalComponent: Component, IComponent + [Component("vsSBE", new[] { "Core" }, "Internal operations with vsSBE")] + public class InternalComponent: ComponentAbstract, IComponent { + protected IEnvironment env; + /// - /// Ability to work with data for current component + /// Expression when to start processing. /// - public override string Condition - { - get { return @"(?:vsSBE|Core)\s"; } - } + public override string Activator => @"(?:vsSBE|Core)\s"; /// /// Use regex engine /// - public override bool CRegex - { - get { return true; } - } + public override bool ARegex => true; - /// Initialization with loader - public InternalComponent(IBootloader loader) - : base(loader) + public IExer Exer { - - } - - /// Used environment - public InternalComponent(IEnvironment env) - : base(env) - { - + get; + protected set; } /// - /// Handler for current data + /// Prepare, parse, and evaluate mixed data through SobaScript supported syntax. /// - /// mixed data - /// prepared and evaluated data - public override string parse(string data) + /// Mixed input data. + /// Evaluated end value. + public override string Eval(string data) { - var point = entryPoint(data); + var point = EntryPoint(data); string subtype = point.Key; string request = point.Value; - Log.Trace("`{0}`: subtype - `{1}`, request - `{2}`", ToString(), subtype, request); + Log.Trace($"`{ToString()}`: subtype - `{subtype}`, request - `{request}`"); IPM pm = new PM(request); - switch(subtype) { + + switch(subtype) + { case "StartUpProject": { return stStartUpProject(pm); } @@ -85,12 +77,25 @@ public override string parse(string data) } } - throw new SubtypeNotFoundException("Subtype `{0}` is not found", subtype); + throw new SubtypeNotFoundException(subtype); + } + + public InternalComponent(ISobaScript soba, IEnvironment env) + : this(soba, env, null) + { + + } + + public InternalComponent(ISobaScript soba, IEnvironment env, IExer exer) + : base(soba) + { + this.env = env ?? throw new ArgumentNullException(nameof(env)); + Exer = exer; } /// /// - [Property("StartUpProject", "To get/set the project by default or 'StartUp Project'.", CValueType.String, CValueType.String)] + [Property("StartUpProject", "To get/set the project by default or 'StartUp Project'.", CValType.String, CValType.String)] protected string stStartUpProject(IPM pm) { if(!pm.It(LevelType.Property, "StartUpProject")) { @@ -98,32 +103,31 @@ protected string stStartUpProject(IPM pm) } // get - if(pm.IsRight(LevelType.RightOperandEmpty)) { return env.StartupProjectString; } // set - if(!pm.IsRight(LevelType.RightOperandStd)) { throw new IncorrectNodeException(pm); } ILevel level = pm.FirstLevel; - var val = (new PM()).arguments(level.Data); + var val = new PM().GetArguments(level.Data); - if(val == null || val.Length < 1) { + if(val == null || val.Count < 1) + { env.updateStartupProject(null); return Value.Empty; } Argument pname = val[0]; - if(val.Length > 1 || + if(val.Count > 1 || (pname.type != ArgumentType.StringDouble && pname.type != ArgumentType.EnumOrConst && pname.type != ArgumentType.Mixed)) { - throw new ArgumentPMException(level, "= string name"); + throw new PMLevelException(level, "= string name"); } env.updateStartupProject(pname.data.ToString()); @@ -136,17 +140,17 @@ protected string stStartUpProject(IPM pm) /// /// [Property("events", "Work with events")] - [Property("Pre", "Pre-Build\nBefore build", "events", "stEvents"), Property("", "Pre", "stEvents")] - [Property("Post", "Post-Build\nAfter build", "events", "stEvents"), Property("", "Post", "stEvents")] - [Property("Cancel", "Cancel-Build\nby user or when occurs error", "events", "stEvents"), Property("", "Cancel", "stEvents")] - [Property("CommandEvent", "CommandEvent (DTE)\nThe Command Events from EnvDTE", "events", "stEvents"), Property("", "CommandEvent", "stEvents")] - [Property("Warnings", "Warnings-Build\nWarnings during assembly processing", "events", "stEvents"), Property("", "Warnings", "stEvents")] - [Property("Errors", "Errors-Build\nErrors during assembly processing", "events", "stEvents"), Property("", "Errors", "stEvents")] - [Property("OWP", "Output-Build\nCustomization and full control by using listener", "events", "stEvents"), Property("", "OWP", "stEvents")] - [Property("SlnOpened", "Sln-Opened\nWhen solution has been opened", "events", "stEvents"), Property("", "SlnOpened", "stEvents")] - [Property("SlnClosed", "Sln-Closed\nWhen solution has been closed", "events", "stEvents"), Property("", "SlnClosed", "stEvents")] - [Property("Transmitter", "Transmitter\nTransmission of the build-data to outer handler", "events", "stEvents"), Property("", "Transmitter", "stEvents")] - [Property("Logging", "Logging\nAll processes with internal logging", "events", "stEvents"), Property("", "Logging", "stEvents")] + [Property("Pre", "Pre-Build\nBefore build", "events", nameof(stEvents)), Property("", "Pre", nameof(stEvents))] + [Property("Post", "Post-Build\nAfter build", "events", nameof(stEvents)), Property("", "Post", nameof(stEvents))] + [Property("Cancel", "Cancel-Build\nby user or when occurs error", "events", nameof(stEvents)), Property("", "Cancel", nameof(stEvents))] + [Property("CommandEvent", "CommandEvent (DTE)\nThe Command Events from EnvDTE", "events", nameof(stEvents)), Property("", "CommandEvent", nameof(stEvents))] + [Property("Warnings", "Warnings-Build\nWarnings during assembly processing", "events", nameof(stEvents)), Property("", "Warnings", nameof(stEvents))] + [Property("Errors", "Errors-Build\nErrors during assembly processing", "events", nameof(stEvents)), Property("", "Errors", nameof(stEvents))] + [Property("OWP", "Output-Build\nCustomization and full control by using listener", "events", nameof(stEvents)), Property("", "OWP", nameof(stEvents))] + [Property("SlnOpened", "Sln-Opened\nWhen solution has been opened", "events", nameof(stEvents)), Property("", "SlnOpened", nameof(stEvents))] + [Property("SlnClosed", "Sln-Closed\nWhen solution has been closed", "events", nameof(stEvents)), Property("", "SlnClosed", nameof(stEvents))] + [Property("Transmitter", "Transmitter\nTransmission of the build-data to outer handler", "events", nameof(stEvents)), Property("", "Transmitter", nameof(stEvents))] + [Property("Logging", "Logging\nAll processes with internal logging", "events", nameof(stEvents)), Property("", "Logging", nameof(stEvents))] protected string stEvents(IPM pm) { if(!pm.Is(LevelType.Property, "events")) { @@ -165,9 +169,9 @@ protected string stEvents(IPM pm) type = (SolutionEventType)Enum.Parse(typeof(SolutionEventType), etype.Data); } catch(ArgumentException) { - throw new OperandNotFoundException("The event type `{0}` was not found.", etype.Data); + throw new OperandNotFoundException(etype.Data); } - return stEventItem(type, pm.pinTo(2)); + return stEventItem(type, pm.PinTo(2)); } throw new IncorrectNodeException(pm, 2); @@ -179,25 +183,21 @@ protected string stEvents(IPM pm) /// Type of available events /// /// - [Method( - "item", + [Method("item", "Access to action by name", - "", "stEvents", - new string[] { "name" }, - new string[] { "Name of the action" }, - CValueType.Void, - CValueType.String - )] - [Method( - "item", + "", nameof(stEvents), + new[] { "name" }, + new[] { "Name of the action" }, + CValType.Void, + CValType.String)] + [Method("item", "Access to action by index", "", - "stEvents", - new string[] { "index" }, - new string[] { "Index of the action >= 1" }, - CValueType.Void, - CValueType.Integer - )] + nameof(stEvents), + new[] { "index" }, + new[] { "Index of the action >= 1" }, + CValType.Void, + CValType.Integer)] protected string stEventItem(SolutionEventType type, IPM pm) { ILevel level = pm.FirstLevel; @@ -214,25 +214,25 @@ protected string stEventItem(SolutionEventType type, IPM pm) evt = getEventByIndex(type, index); } else { - throw new InvalidArgumentException("Incorrect arguments to `item( string name | integer index )`"); + throw new PMLevelException(level, "`item( string name | integer index )`"); } // .item(...). if(pm.Is(1, LevelType.Property, "Enabled")) { - return pEnabled(evt, pm.pinTo(2)); + return pEnabled(evt, pm.PinTo(2)); } if(pm.Is(1, LevelType.Method, "run")) { - return mActionRun(type, evt, pm.pinTo(1)); + return mActionRun(type, evt, pm.PinTo(1)); } if(pm.Is(1, LevelType.Property, "Status")) { - return itemStatus(type, index, pm.pinTo(1)); + return itemStatus(type, index, pm.PinTo(1)); } if(pm.Is(1, LevelType.Property, "stdout")) { - return pStdout(evt, pm.pinTo(2)); + return pStdout(evt, pm.PinTo(2)); } if(pm.Is(1, LevelType.Property, "stderr")) { - return pStderr(evt, pm.pinTo(2)); + return pStderr(evt, pm.PinTo(2)); } throw new IncorrectNodeException(pm, 1); @@ -246,8 +246,8 @@ protected string stEventItem(SolutionEventType type, IPM pm) /// Access to action by index. /// /// - [Property("Status", "Available states for selected event-action.", "item", "stEventItem")] - [Property("HasErrors", "Checking existence of errors after executed action for selected event-action.", "Status", "itemStatus", CValueType.Boolean)] + [Property("Status", "Available states for selected event-action.", "item", nameof(stEventItem))] + [Property("HasErrors", "Checking existence of errors after executed action for selected event-action.", "Status", nameof(itemStatus), CValType.Boolean)] protected string itemStatus(SolutionEventType type, int index, IPM pm) { if(!pm.Is(LevelType.Property, "Status")) { @@ -256,9 +256,9 @@ protected string itemStatus(SolutionEventType type, int index, IPM pm) if(pm.FinalEmptyIs(1, LevelType.Property, "HasErrors")) { - string status = Value.from(Status._.get(type, index) == StatusType.Fail); + string status = Value.From(Status._.get(type, index) == StatusType.Fail); #if DEBUG - Log.Trace("pStatus: status - '{0}'", status); + Log.Trace($"pStatus: status - '{status}'"); #endif return status; } @@ -266,21 +266,21 @@ protected string itemStatus(SolutionEventType type, int index, IPM pm) throw new IncorrectNodeException(pm, 1); } - [Property("stdout", "Get data from stdout for action which is executed asynchronously.", "item", "stEventItem", CValueType.String)] + [Property("stdout", "Get data from stdout for action which is executed asynchronously.", "item", nameof(stEventItem), CValType.String)] protected string pStdout(ISolutionEvent evt, IPM pm) { if(pm.FinalEmptyIs(LevelType.RightOperandEmpty)) { - return Value.from(HProcess.Stdout(evt.Id)); + return Value.From(Exer?.PullStdOut(evt.Id)); } throw new IncorrectNodeException(pm); } - [Property("stderr", "Get data from stderr for action which is executed asynchronously.", "item", "stEventItem", CValueType.String)] + [Property("stderr", "Get data from stderr for action which is executed asynchronously.", "item", nameof(stEventItem), CValType.String)] protected string pStderr(ISolutionEvent evt, IPM pm) { if(pm.FinalEmptyIs(LevelType.RightOperandEmpty)) { - return Value.from(HProcess.Stderr(evt.Id)); + return Value.From(Exer?.PullStdErr(evt.Id)); } throw new IncorrectNodeException(pm); @@ -293,39 +293,35 @@ protected string pStderr(ISolutionEvent evt, IPM pm) /// Selected event /// /// - [Property("Enabled", "Gets or Sets Enabled status for selected event-action", "item", "stEventItem", CValueType.Boolean, CValueType.Boolean)] + [Property("Enabled", "Gets or Sets Enabled status for selected event-action", "item", nameof(stEventItem), CValType.Boolean, CValType.Boolean)] protected string pEnabled(ISolutionEvent evt, IPM pm) { if(pm.FinalEmptyIs(LevelType.RightOperandEmpty)) { - return Value.from(evt.Enabled); + return Value.From(evt.Enabled); } - evt.Enabled = Value.toBoolean(pm.FirstLevel.Data); + evt.Enabled = Value.ToBoolean(pm.FirstLevel.Data); - Log.Trace("pEnabled: updated status '{0}' for '{1}'", evt.Enabled, evt.Name); + Log.Trace($"pEnabled: updated status '{evt.Enabled}' for '{evt.Name}'"); return Value.Empty; } - [Method( - "run", + [Method("run", "Execute Action with specific context. Returns true value if it was handled.", "item", - "stEventItem", - new string[] { "context" }, - new string[] { "Specific context." }, - CValueType.Boolean, - CValueType.Enum - )] - [Method( - "run", + nameof(stEventItem), + new[] { "context" }, + new[] { "Specific context." }, + CValType.Boolean, + CValType.Enum)] + [Method("run", "Execute Action. Returns true value if it was handled.", "item", - "stEventItem", - new string[] { "" }, - new string[] { "" }, - CValueType.Boolean, - CValueType.Void - )] + nameof(stEventItem), + new[] { "" }, + new[] { "" }, + CValType.Boolean, + CValType.Void)] protected string mActionRun(SolutionEventType type, ISolutionEvent evt, IPM pm) { if(!pm.FinalEmptyIs(LevelType.Method, "run")) { @@ -334,21 +330,21 @@ protected string mActionRun(SolutionEventType type, ISolutionEvent evt, IPM pm) ILevel level = pm.FirstLevel; BuildType buildType; - if(level.Args == null || level.Args.Length < 1) { + if(level.Args == null || level.Args.Count < 1) { buildType = BuildType.Common; } else if(level.Is(ArgumentType.EnumOrConst)) { buildType = (BuildType)Enum.Parse(typeof(BuildType), (string)level.Args[0].data); } else { - throw new ArgumentPMException(level, "run([enum context])"); + throw new PMLevelException(level, "run([enum context])"); } - ICommand cmd = new Actions.Command(env, script, msbuild); + ICommand cmd = new Actions.Command(env, soba, emsbuild); Log.Info($"Execute action by user-script: '{evt.Name}'(context: {buildType}) /as '{type}' event"); cmd.Env.BuildType = buildType; - return Value.from(cmd.exec(evt, type)); + return Value.From(cmd.exec(evt, type)); } protected virtual ISolutionEvent[] getEvent(SolutionEventType type) @@ -357,7 +353,7 @@ protected virtual ISolutionEvent[] getEvent(SolutionEventType type) return Settings.Cfg.getEvent(type); //TODO: } catch(NotFoundException) { - throw new NotSupportedOperationException("The event type '{0}' is not supported yet.", type); + throw new NotSupportedOperationException($"The event type '{type}' is not supported yet."); } } @@ -367,19 +363,20 @@ protected virtual ISolutionEvent[] getEvent(SolutionEventType type) /// private ISolutionEvent getEventByName(SolutionEventType type, string name, out int index) { - if(String.IsNullOrWhiteSpace(name)) { - throw new NotFoundException("The name of event type is null or empty."); + if(string.IsNullOrWhiteSpace(name)) { + throw new ArgumentNullException(nameof(name)); } index = -1; - foreach(ISolutionEvent item in getEvent(type)) { + foreach(ISolutionEvent item in getEvent(type)) + { ++index; if(item.Name == name) { return item; } } - throw new NotFoundException("The event type '{0}' with name '{1}' is not exists.", type, name); + throw new NotFoundException(name, $"Event type `{type}`.", type); } private ISolutionEvent getEventByIndex(SolutionEventType type, int index) @@ -389,7 +386,7 @@ private ISolutionEvent getEventByIndex(SolutionEventType type, int index) return evt[index - 1]; // starts with 1 } catch(IndexOutOfRangeException) { - throw new NotFoundException("Incorrect index '{0}' for event type - `{1}` /{2}", index, type, evt.Length); + throw new NotFoundException(type, $"For index '{index}' /{evt.Length}", index, evt.Length); } } } diff --git a/vsSolutionBuildEvent/SolutionEvents.cs b/vsSolutionBuildEvent/SolutionEvents.cs index 627002cd..eb97c23f 100644 --- a/vsSolutionBuildEvent/SolutionEvents.cs +++ b/vsSolutionBuildEvent/SolutionEvents.cs @@ -16,6 +16,7 @@ */ using System; +using net.r_eg.SobaScript.Exceptions; using net.r_eg.vsSBE.Configuration; using net.r_eg.vsSBE.Events; using net.r_eg.vsSBE.Exceptions; @@ -211,7 +212,7 @@ public ISolutionEvent[] getEvent(SolutionEventType type) } } - throw new NotFoundException("getEvent: the event type '{0}' is not found.", type); + throw new NotFoundException(type); } } } diff --git a/vsSolutionBuildEvent/SzArchiver.cs b/vsSolutionBuildEvent/SzArchiver.cs new file mode 100644 index 00000000..9e47e3ff --- /dev/null +++ b/vsSolutionBuildEvent/SzArchiver.cs @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . +*/ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using net.r_eg.SobaScript.Z.Ext.Extensions; +using net.r_eg.SobaScript.Z.Ext.SevenZip; +using SevenZip; + +namespace net.r_eg.vsSBE +{ + internal sealed class SzArchiver: IArchiver + { + /// + /// The name of library with an complete 7-Zip engine (not a 7za/7zxa). + /// + internal const string LIB_7Z = "7z.dll"; + + private bool Is32bit => IntPtr.Size == 4; + + public bool Compress(IEnumerable files, string output, MethodType method, RateType rate, FormatType format) + { + var z = GetCompressor(method, rate, format); + z.DirectoryStructure = true; + + z.CompressFiles(output, files.ToArray()); + return true; + } + + public bool Compress(string dir, string output, MethodType method, RateType rate, FormatType format) + { + var z = GetCompressor(method, rate, format); + z.IncludeEmptyDirectories = true; + + z.CompressDirectory(dir, output); + return true; + } + + public bool Extract(string file, string output, string pwd = null) + { + using(var zip = GetExtractor(file, pwd)) + { + try + { + zip.ExtractArchive(output); + return true; + } + catch(SevenZipArchiveException ex) + { + Log.Debug($"Failed {nameof(Extract)}: {ex.Message}"); + return false; + } + } + } + + public bool Check(string file, string pwd = null) + { + using(var zip = GetExtractor(file, pwd)) + { + try + { + return zip.Check(); + } + catch(SevenZipArchiveException ex) + { + Log.Debug($"Failed {nameof(Check)}: {ex.Message}"); + return false; + } + } + } + + public SzArchiver() + { + string cPath = "".GetExecDir(); + string zPath = Is32bit ? cPath : Path.Combine(cPath, "x64"); + + Log.Debug($"7z lib path '{zPath}'"); + try + { + SevenZipBase.SetLibraryPath(Path.Combine(zPath, LIB_7Z)); + } + catch(Exception ex) + { + Log.Warn( $"Found problem with library {LIB_7Z} ({zPath}): `{ex.Message}`"); + throw; + } + } + + private SevenZipCompressor GetCompressor(MethodType method, RateType rate, FormatType format) + { + return new SevenZipCompressor() + { + CompressionMethod = Convert(method), + CompressionLevel = Convert(rate), + ArchiveFormat = Convert(format), + CompressionMode = CompressionMode.Create, + FastCompression = true, // disables some events inside SevenZip + }; + } + + private SevenZipExtractor GetExtractor(string file, string pwd = null) + => string.IsNullOrEmpty(pwd) ? + new SevenZipExtractor(file) : new SevenZipExtractor(file, pwd); + + private CompressionMethod Convert(MethodType method) + { + switch(method) + { + case MethodType.BZip2: return CompressionMethod.BZip2; + case MethodType.Copy: return CompressionMethod.Copy; + case MethodType.Deflate: return CompressionMethod.Deflate; + case MethodType.Deflate64: return CompressionMethod.Deflate64; + case MethodType.Lzma: return CompressionMethod.Lzma; + case MethodType.Lzma2: return CompressionMethod.Lzma2; + case MethodType.Ppmd: return CompressionMethod.Ppmd; + } + + throw new NotSupportedException(nameof(method)); + } + + private CompressionLevel Convert(RateType rate) + { + switch(rate) + { + case RateType.Fast: return CompressionLevel.Fast; + case RateType.High: return CompressionLevel.High; + case RateType.Low: return CompressionLevel.Low; + case RateType.None: return CompressionLevel.None; + case RateType.Normal: return CompressionLevel.Normal; + case RateType.Ultra: return CompressionLevel.Ultra; + } + + throw new NotSupportedException(nameof(rate)); + } + + private OutArchiveFormat Convert(FormatType format) + { + switch(format) + { + case FormatType.BZip2: return OutArchiveFormat.BZip2; + case FormatType.GZip: return OutArchiveFormat.GZip; + case FormatType.SevenZip: return OutArchiveFormat.SevenZip; + case FormatType.Tar: return OutArchiveFormat.Tar; + case FormatType.XZ: return OutArchiveFormat.XZ; + case FormatType.Zip: return OutArchiveFormat.Zip; + } + + throw new NotSupportedException(nameof(format)); + } + } +} diff --git a/vsSolutionBuildEvent/UI/WForms/Controls/CompletionData.cs b/vsSolutionBuildEvent/UI/WForms/Controls/CompletionData.cs new file mode 100644 index 00000000..9fe1fbf7 --- /dev/null +++ b/vsSolutionBuildEvent/UI/WForms/Controls/CompletionData.cs @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . +*/ + +using System; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using ICSharpCode.AvalonEdit.CodeCompletion; +using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.AvalonEdit.Editing; +using net.r_eg.SobaScript.Mapper; + +namespace net.r_eg.vsSBE.UI.WForms.Controls +{ + internal sealed class CompletionData: ICompletionData + { + public ImageSource Image + { + get; + private set; + } + + public string Text + { + get; + private set; + } + + public object Content + { + get; + private set; + } + + public object Description + { + get; + private set; + } + + /// + /// Used in the selection logic to selecting those items + /// which the user is accessing most frequently. + /// + public double Priority => 0; + + /// + /// Perform the completion + /// + /// The text area on which completion is performed. + /// The text segment that was used by the completion window if + /// the user types (segment between CompletionWindow.StartOffset and CompletionWindow.EndOffset). + /// The EventArgs used for the insertion request. + /// These can be TextCompositionEventArgs, KeyEventArgs, MouseEventArgs, depending on how + /// the insertion was triggered. + public void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs) + { + int pos = completionSegment.Offset; + for(int i = pos - 1; i >= 0; --i) + { + if(!char.IsLetterOrDigit(textArea.Document.Text[i])) { + pos = i + 1; + break; + } + } + textArea.Document.Replace(pos, completionSegment.EndOffset - pos, Text); + } + + public CompletionData(INodeInfo info, Bitmap img = null) + { + Text = info.Name ?? throw new ArgumentNullException(nameof(info)); + Image = img == null ? ImageFrom(info.Type) : ImageFrom(img); + Content = info.Overname; + Description = info.Description; + } + + + + + ///// Used to filter the list of visible elements and inserting + ///// Text to display in the list + ///// Description for tooltip + ///// Image in the list + //public CompletionData(string text, string content, string description, ImageSource image = null) + //{ + // Text = text; + // Description = description; + // Image = image; + //} + + ///// Used to filter the list of visible elements and inserting + ///// Description for tooltip + ///// Image in the list + //public CompletionData(string text, string description, ImageSource image = null) + // : this(text, null, description, image) + //{ + + //} + + ///// Used to filter the list of visible elements and inserting + ///// Text to display in the list + ///// Description for tooltip + ///// Image in the list + //public CompletionData(string text, string content, string description, Bitmap image) + // : this(text, description) + //{ + // Image = imageFrom(image); + //} + + ///// Used to filter the list of visible elements and inserting + ///// Description for tooltip + ///// Image in the list + //public CompletionData(string text, string description, Bitmap image) + // : this(text, null, description, image) + //{ + + //} + + ///// Used to filter the list of visible elements and inserting + ///// Text to display in the list + ///// Description for tooltip + ///// Type of used element + //public CompletionData(string text, string content, string description, NodeType type) + // : this(text, description) + //{ + // Image = imageFrom(type); + // this.content = content; + //} + + ///// Used to filter the list of visible elements and inserting + ///// Description for tooltip + ///// Type of used element + //public CompletionData(string text, string description, NodeType type) + // : this(text, null, description, type) + //{ + + //} + + private ImageSource ImageFrom(NodeType type) + { + switch(type) + { + case NodeType.Component: { + return ImageFrom(DomIcon.package); + } + case NodeType.Definition: { + return ImageFrom(DomIcon.definition); + } + case NodeType.Property: { + return ImageFrom(DomIcon.property); + } + case NodeType.Method: { + return ImageFrom(DomIcon.function); + } + case NodeType.AliasToDefinition: + case NodeType.AliasToComponent: { + return ImageFrom(DomIcon.alias); + } + } + + return null; + } + + private ImageSource ImageFrom(Bitmap bmap) + { + MemoryStream ms = new MemoryStream(); + bmap.Save(ms, ImageFormat.Png); + + BitmapImage img = new BitmapImage(); + img.BeginInit(); + img.StreamSource = ms; + img.EndInit(); + + //ms.Dispose(); + return img; + } + } +} diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/Icon.Designer.cs b/vsSolutionBuildEvent/UI/WForms/Controls/DomIcon.Designer.cs similarity index 94% rename from vsSolutionBuildEvent/SBEScripts/Dom/Icon.Designer.cs rename to vsSolutionBuildEvent/UI/WForms/Controls/DomIcon.Designer.cs index 33238bf3..11c951c5 100644 --- a/vsSolutionBuildEvent/SBEScripts/Dom/Icon.Designer.cs +++ b/vsSolutionBuildEvent/UI/WForms/Controls/DomIcon.Designer.cs @@ -1,14 +1,14 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ -namespace net.r_eg.vsSBE.SBEScripts.Dom { +namespace net.r_eg.vsSBE.UI.WForms.Controls { using System; @@ -19,17 +19,17 @@ namespace net.r_eg.vsSBE.SBEScripts.Dom { // 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Icon { + internal class DomIcon { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Icon() { + internal DomIcon() { } /// @@ -39,7 +39,7 @@ internal Icon() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("net.r_eg.vsSBE.SBEScripts.Dom.Icon", typeof(Icon).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("net.r_eg.vsSBE.UI.WForms.Controls.DomIcon", typeof(DomIcon).Assembly); resourceMan = temp; } return resourceMan; diff --git a/vsSolutionBuildEvent/SBEScripts/Dom/Icon.resx b/vsSolutionBuildEvent/UI/WForms/Controls/DomIcon.resx similarity index 91% rename from vsSolutionBuildEvent/SBEScripts/Dom/Icon.resx rename to vsSolutionBuildEvent/UI/WForms/Controls/DomIcon.resx index 2ac531a5..bd2cfd71 100644 --- a/vsSolutionBuildEvent/SBEScripts/Dom/Icon.resx +++ b/vsSolutionBuildEvent/UI/WForms/Controls/DomIcon.resx @@ -119,18 +119,18 @@ - ..\..\Resources\components\alias.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\..\..\Resources\components\alias.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\..\Resources\components\definition.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\..\..\Resources\components\definition.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\..\Resources\components\function.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\..\..\Resources\components\function.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\..\Resources\components\package.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\..\..\Resources\components\package.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\..\Resources\components\property.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\..\..\Resources\components\property.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/vsSolutionBuildEvent/UI/WForms/Controls/TextEditor.cs b/vsSolutionBuildEvent/UI/WForms/Controls/TextEditor.cs index 86b0b237..94c2b6d1 100644 --- a/vsSolutionBuildEvent/UI/WForms/Controls/TextEditor.cs +++ b/vsSolutionBuildEvent/UI/WForms/Controls/TextEditor.cs @@ -16,7 +16,6 @@ */ using System; -using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.Design; using System.IO; @@ -32,9 +31,9 @@ using ICSharpCode.AvalonEdit.Highlighting.Xshd; using ICSharpCode.AvalonEdit.Rendering; using ICSharpCode.AvalonEdit.Search; +using net.r_eg.EvMSBuild; +using net.r_eg.SobaScript.Mapper; using net.r_eg.vsSBE.Configuration.User; -using net.r_eg.vsSBE.MSBuild; -using net.r_eg.vsSBE.SBEScripts.Dom; using net.r_eg.vsSBE.UI.WForms.Controls.TextEditorElements; using AvalonEditorWPF = ICSharpCode.AvalonEdit.TextEditor; using InputModifierKeys = System.Windows.Input.ModifierKeys; @@ -108,7 +107,7 @@ public bool CodeCompletionEnabled /// /// Analyzer of all registered IComponent /// - protected DomParser dom; + protected ISbMapper dom; /// /// Original value of the FontSize. @@ -156,9 +155,9 @@ public bool CodeCompletionEnabled /// /// /// - public void codeCompletionInit(IInspector inspector, IMSBuild msbuild = null) + public void codeCompletionInit(IInspector inspector, IEvMSBuild msbuild = null) { - dom = new DomParser(inspector, msbuild); + dom = new SbMapper(inspector, msbuild); Log.Trace("Code completion has been initialized for '{0}'", Name); } @@ -300,7 +299,7 @@ protected void updateFoldings() foldingManager.Clear(); } - protected void showCodeCompletion(DomParser.KeysCommand cmd) + protected void showCodeCompletion(KDataCommand cmd) { if(completionWindow != null) { return; @@ -310,7 +309,7 @@ protected void showCodeCompletion(DomParser.KeysCommand cmd) return; } - IEnumerable data = dom.find(_.TextArea.Document.Text, _.TextArea.Caret.Offset, cmd); + var data = dom.Find(_.TextArea.Document.Text, _.TextArea.Caret.Offset, cmd); if(data == null) { return; } @@ -320,8 +319,8 @@ protected void showCodeCompletion(DomParser.KeysCommand cmd) completionWindow = null; }; - foreach(ICompletionData item in data) { - completionWindow.CompletionList.CompletionData.Add(item); + foreach(INodeInfo item in data) { + completionWindow.CompletionList.CompletionData.Add(new CompletionData(item)); } completionWindow.Show(); } @@ -403,7 +402,7 @@ private void editorTextArea_KeyDown(object sender, System.Windows.Input.KeyEvent { if(InputModifierKeys.Control == (Keyboard.Modifiers & InputModifierKeys.Control) && e.Key == Key.Space) { e.Handled = true; - showCodeCompletion(DomParser.KeysCommand.CtrlSpace); + showCodeCompletion(KDataCommand.CtrlSpace); } } @@ -421,21 +420,21 @@ private void editorTextArea_TextEntering(object sender, TextCompositionEventArgs private void editorTextArea_TextEntered(object sender, TextCompositionEventArgs e) { - DomParser.KeysCommand cmd = DomParser.KeysCommand.Default; + var cmd = KDataCommand.Default; if(e.Text == "[" && _.TextArea.Document.Text[Math.Max(0, _.TextArea.Caret.Offset - 2)] == '#') { - cmd = DomParser.KeysCommand.Container; + cmd = KDataCommand.Container; } else if(e.Text == ".") { - cmd = DomParser.KeysCommand.LevelByDot; + cmd = KDataCommand.LevelByDot; } else if(e.Text == " ") { - cmd = DomParser.KeysCommand.Space; + cmd = KDataCommand.Space; } else if(e.Text == "(" && _.TextArea.Document.Text[Math.Max(0, _.TextArea.Caret.Offset - 2)] == '$') { - cmd = DomParser.KeysCommand.MSBuildContainer; + cmd = KDataCommand.MSBuildContainer; } - if(cmd != DomParser.KeysCommand.Default) { + if(cmd != KDataCommand.Default) { showCodeCompletion(cmd); } } diff --git a/vsSolutionBuildEvent/UI/WForms/EnvDteSniffer.cs b/vsSolutionBuildEvent/UI/WForms/EnvDteSniffer.cs index 9758455c..d6ce1486 100644 --- a/vsSolutionBuildEvent/UI/WForms/EnvDteSniffer.cs +++ b/vsSolutionBuildEvent/UI/WForms/EnvDteSniffer.cs @@ -17,7 +17,7 @@ using System; using System.Windows.Forms; -using net.r_eg.vsSBE.SBEScripts; +using net.r_eg.SobaScript; using net.r_eg.vsSBE.UI.WForms.Controls; using CEAfterEventHandler = EnvDTE._dispCommandEvents_AfterExecuteEventHandler; using CEBeforeEventHandler = EnvDTE._dispCommandEvents_BeforeExecuteEventHandler; @@ -100,7 +100,7 @@ protected void commandEvent(bool pre, string guid, int id, object customIn, obje } string tFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern + " .fff"; - dgvCESniffer.Rows.Add(DateTime.Now.ToString(tFormat), pre, guid, id, Value.pack(customIn), Value.pack(customOut), Util.enumViewBy(guid, id)); + dgvCESniffer.Rows.Add(DateTime.Now.ToString(tFormat), pre, guid, id, Value.Pack(customIn), Value.Pack(customOut), Util.enumViewBy(guid, id)); } protected void flash(Lights.FlashType type, int delay = 250) diff --git a/vsSolutionBuildEvent/UI/WForms/EventsFrm.cs b/vsSolutionBuildEvent/UI/WForms/EventsFrm.cs index 589237ed..2f990079 100644 --- a/vsSolutionBuildEvent/UI/WForms/EventsFrm.cs +++ b/vsSolutionBuildEvent/UI/WForms/EventsFrm.cs @@ -20,15 +20,14 @@ using System.Drawing; using System.Linq; using System.Windows.Forms; +using net.r_eg.SobaScript; +using net.r_eg.SobaScript.Mapper; using net.r_eg.vsSBE.Bridge; using net.r_eg.vsSBE.Events; using net.r_eg.vsSBE.Events.CommandEvents; using net.r_eg.vsSBE.Extensions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Dom; using net.r_eg.vsSBE.UI.WForms.Components; using net.r_eg.vsSBE.UI.WForms.Controls; -using DomIcon = net.r_eg.vsSBE.SBEScripts.Dom.Icon; namespace net.r_eg.vsSBE.UI.WForms { @@ -37,7 +36,7 @@ namespace net.r_eg.vsSBE.UI.WForms /// ...when it's only started and when we had no any big plans before... /// Thus, for all new, I strongly recommend MVVM or similar pattern to improve IoC and more. /// - public partial class EventsFrm: Form, ITransfer + internal partial class EventsFrm: Form, ITransfer { public const int WM_SYSCOMMAND = 0x0112; public const int SC_RESTORE = 0xF120; @@ -167,24 +166,22 @@ public void action(SolutionEventType type, ISolutionEvent cfg) MessageBox.Show(String.Format("The new action `{0}`:\n`{1}` has been added.", evt.Name, evt.Caption), "New action"); } - /// - public EventsFrm(IBootloader bootloader) + /// + public EventsFrm(Bootloader loader) { InitializeComponent(); defaultSizes(); updateColors(); - IInspector inspector = new Inspector(bootloader); - logic = new Logic.Events(bootloader, inspector); - textEditor.codeCompletionInit(inspector, new MSBuild.Parser(bootloader.Env, bootloader.UVariable)); + IInspector inspector = new Inspector(loader.Soba); + logic = new Logic.Events(loader, inspector); + textEditor.codeCompletionInit(inspector, loader.Soba.EvMSBuild); Icon = Resource.Package_32; toolTip.SetToolTip(pictureBoxWarnWait, Resource.StringWarnForWaiting); #if DEBUG this.Text = String.Format("{0} [Debug version]", Settings.APP_NAME); - toolStripMenuDebugMode.Checked = true; - toolStripMenuDebugMode.Enabled = false; toolStripMenuVersion.Text = String.Format("based on {0}", Version.branchSha1); #else //if(Version.branchName.ToLower() != "releases") { @@ -354,8 +351,8 @@ protected void saveData(ICommandEvent evt) continue; } - object customIn = Value.packArgument(row.Cells[dgvCEFiltersColumnCustomIn.Name].Value); - object customOut = Value.packArgument(row.Cells[dgvCEFiltersColumnCustomOut.Name].Value); + object customIn = Value.PackArgument(row.Cells[dgvCEFiltersColumnCustomIn.Name].Value); + object customOut = Value.PackArgument(row.Cells[dgvCEFiltersColumnCustomOut.Name].Value); object guid = row.Cells[dgvCEFiltersColumnGuid.Name].Value; list.Add(new Filter() @@ -542,7 +539,7 @@ protected void renderData(ICommandEvent evt) return; } foreach(IFilter f in evt.Filters) { - dgvCEFilters.Rows.Add(f.Guid, f.Id, Value.pack(f.CustomIn), Value.pack(f.CustomOut), f.Description, f.Cancel, f.Pre, f.Post); + dgvCEFilters.Rows.Add(f.Guid, f.Id, Value.Pack(f.CustomIn), Value.Pack(f.CustomOut), f.Description, f.Cancel, f.Pre, f.Post); } } @@ -967,7 +964,7 @@ protected void commandEvent(bool pre, string guid, int id, object customIn, obje } string tFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern + " .fff"; - dgvCESniffer.Rows.Add(DateTime.Now.ToString(tFormat), pre, guid, id, Value.pack(customIn), Value.pack(customOut), Util.enumViewBy(guid, id)); + dgvCESniffer.Rows.Add(DateTime.Now.ToString(tFormat), pre, guid, id, Value.Pack(customIn), Value.Pack(customOut), Util.enumViewBy(guid, id)); } protected void addFilterFromSniffer(DataGridView sniffer, DataGridView filter) @@ -1342,10 +1339,8 @@ private void toolStripMenuReport_Click(object sender, EventArgs e) private void toolStripMenuDebugMode_Click(object sender, EventArgs e) { -#if !DEBUG App.UserConfig.Global.DebugMode = App.DebugMode = toolStripMenuDebugMode.Checked = !toolStripMenuDebugMode.Checked; logic.updateUserCfg(); -#endif } private void menuCfgSuppressDualCmd_Click(object sender, EventArgs e) @@ -1445,20 +1440,20 @@ private void dgvComponents_RowEnter(object sender, DataGridViewCellEventArgs e) { Bitmap bmap = DomIcon.definition; switch(info.Type) { - case InfoType.Property: { + case NodeType.Property: { bmap = DomIcon.property; break; } - case InfoType.Method: { + case NodeType.Method: { bmap = DomIcon.function; break; } - case InfoType.Definition: { + case NodeType.Definition: { bmap = DomIcon.definition; break; } } - dgvComponentInfo.Rows.Add(bmap, info.Displaying, (info.Signature == null)? "" : info.Signature.Replace("\n", " \n"), info.Description); + dgvComponentInfo.Rows.Add(bmap, info.Overname, (info.Signature == null)? "" : info.Signature.Replace("\n", " \n"), info.Description); } } @@ -1552,7 +1547,7 @@ private void menuWizardVersion_Click(object sender, EventArgs e) if(Util.focusForm(frmWizVersion)) { return; } - frmWizVersion = new Wizards.VersionFrm(logic.Bootloader, this); + frmWizVersion = new Wizards.VersionFrm(logic.Loader, this); frmWizVersion.Show(); } @@ -1859,9 +1854,7 @@ private void menuLogIgnoreError_Click(object sender, EventArgs e) private void toolStripMenuBug_DropDownOpening(object sender, EventArgs e) { -#if !DEBUG toolStripMenuDebugMode.Checked = App.DebugMode; -#endif Func IsIgnoreLevel = (string level) => { diff --git a/vsSolutionBuildEvent/UI/WForms/Logic/Events.cs b/vsSolutionBuildEvent/UI/WForms/Logic/Events.cs index fcb7f8ee..3c47c6fa 100644 --- a/vsSolutionBuildEvent/UI/WForms/Logic/Events.cs +++ b/vsSolutionBuildEvent/UI/WForms/Logic/Events.cs @@ -21,23 +21,21 @@ using System.Linq; using System.Text.RegularExpressions; using System.Windows.Forms; +using net.r_eg.SobaScript.Components; +using net.r_eg.SobaScript.Mapper; using net.r_eg.vsSBE.Bridge; using net.r_eg.vsSBE.Configuration; using net.r_eg.vsSBE.Configuration.User; using net.r_eg.vsSBE.Events; -using net.r_eg.vsSBE.Exceptions; using net.r_eg.vsSBE.Extensions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Dom; +using net.r_eg.vsSBE.UI.WForms.Controls; namespace net.r_eg.vsSBE.UI.WForms.Logic { - using CEAfterEventHandler = EnvDTE._dispCommandEvents_AfterExecuteEventHandler; - using CEBeforeEventHandler = EnvDTE._dispCommandEvents_BeforeExecuteEventHandler; - using DomIcon = Icon; + using CEAfterEventHandler = EnvDTE._dispCommandEvents_AfterExecuteEventHandler; + using CEBeforeEventHandler = EnvDTE._dispCommandEvents_BeforeExecuteEventHandler; - public class Events + internal class Events { /// /// Prefix for new action by default. @@ -106,7 +104,7 @@ public IEnvironment Env /// /// Used loader /// - public IBootloader Bootloader + public Bootloader Loader { get; protected set; @@ -471,10 +469,10 @@ public BuildType getBuildTypeBy(int index) public void fillComponents(DataGridView grid) { grid.Rows.Clear(); - foreach(IComponent c in Bootloader.Registered) + foreach(IComponent c in Loader.Soba.Registered) { Type type = c.GetType(); - if(!Inspector.isComponent(type)) { + if(!Inspector.IsComponent(type)) { continue; } @@ -528,7 +526,7 @@ public void fillComponents(DataGridView grid) public void updateComponents(Configuration.Component[] components) { SlnEvents.Components = components; - foreach(IComponent c in Bootloader.Registered) { + foreach(IComponent c in Loader.Soba.Registered) { Configuration.Component found = components.Where(p => p.ClassName == c.GetType().Name).FirstOrDefault(); if(found != null) { c.Enabled = found.Enabled; @@ -626,7 +624,7 @@ public ISolutionEvent addEventItem(int copy = -1) break; } default: { - throw new InvalidArgumentException("Unsupported SolutionEventType: '{0}'", SBE.type); + throw new ArgumentException($"Unsupported SolutionEventType: '{SBE.type}'"); } } SBE.update(); @@ -864,9 +862,12 @@ public void execAction() Log.Info("No actions to execution. Add new, then try again."); return; } - Actions.ICommand cmd = new Actions.Command(Bootloader.Env, - new Script(Bootloader), - new MSBuild.Parser(Bootloader.Env, Bootloader.UVariable)); + Actions.ICommand cmd = new Actions.Command + ( + Loader.Env, + Loader.Soba, + Loader.Soba.EvMSBuild + ); ISolutionEvent evt = SBEItem; SolutionEventType type = SBE.type; @@ -882,11 +883,12 @@ public void execAction() } } - public Events(IBootloader bootloader, IInspector inspector = null) + public Events(Bootloader loader, IInspector inspector = null) { - this.Bootloader = bootloader; + Loader = loader; this.inspector = inspector; - Env = bootloader.Env; + Env = loader.Env; + backupUpdate(); } @@ -990,13 +992,13 @@ protected IEnumerable domElemsBy(string className) } List ret = new List(); - foreach(IComponent c in Bootloader.Registered) + foreach(IComponent c in Loader.Soba.Registered) { if(c.GetType().Name != className) { continue; } - foreach(INodeInfo info in inspector.getBy(c.GetType())) { + foreach(INodeInfo info in inspector.GetBy(c.GetType())) { ret.Add(info); ret.AddRange(domElemsBy(info.Link)); } @@ -1010,7 +1012,7 @@ protected IEnumerable domElemsBy(string className) protected IEnumerable domElemsBy(NodeIdent ident) { - foreach(INodeInfo info in inspector.getBy(ident)) + foreach(INodeInfo info in inspector.GetBy(ident)) { if(!String.IsNullOrEmpty(info.Name)) { yield return info; diff --git a/vsSolutionBuildEvent/UI/WForms/PropertiesFrm.cs b/vsSolutionBuildEvent/UI/WForms/PropertiesFrm.cs index 998fd9d7..7ca76fd5 100644 --- a/vsSolutionBuildEvent/UI/WForms/PropertiesFrm.cs +++ b/vsSolutionBuildEvent/UI/WForms/PropertiesFrm.cs @@ -20,6 +20,7 @@ using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; +using net.r_eg.EvMSBuild; namespace net.r_eg.vsSBE.UI.WForms { @@ -33,7 +34,7 @@ public partial class PropertiesFrm: Form /// /// Work with properties /// - private MSBuild.Parser _msbuild; + private IEvMSBuild _msbuild; /// /// @@ -43,7 +44,7 @@ public partial class PropertiesFrm: Form /// /// Caching of retrieved properties /// - private ConcurrentDictionary> _cacheProperties; + private ConcurrentDictionary> _cacheProperties; public PropertiesFrm(IEnvironment env, ITransfer pin) { @@ -51,9 +52,9 @@ public PropertiesFrm(IEnvironment env, ITransfer pin) Icon = Resource.Package_32; _env = env; - _msbuild = new MSBuild.Parser(_env); + _msbuild = MSBuild.MakeEvaluator(_env); _pin = pin; - _cacheProperties = new ConcurrentDictionary>(); + _cacheProperties = new ConcurrentDictionary>(); } protected void fillProjects() @@ -76,7 +77,7 @@ protected void fillProperties(string project, string filterName = null, string f dataGridViewVariables.Rows.Clear(); try { - foreach(MSBuild.PropertyItem prop in _getProperties(project)) + foreach(PropertyItem prop in _getProperties(project)) { if(!String.IsNullOrEmpty(filterName) && !cmp(prop.name, filterName, mFilterRegexp.Checked)) { continue; @@ -148,8 +149,7 @@ protected void keyDownToDGV(DataGridView grid, object sender, KeyEventArgs e) } } - /// if not found the specific project - private List _getProperties(string project) + private IEnumerable _getProperties(string project) { string key = project; if(String.IsNullOrEmpty(key)) { @@ -158,7 +158,7 @@ protected void keyDownToDGV(DataGridView grid, object sender, KeyEventArgs e) if(!_cacheProperties.ContainsKey(key)) { - _cacheProperties[key] = _msbuild.listProperties(project); + _cacheProperties[key] = _msbuild.ListProperties(project); Log.Debug("Properties has been saved in the cache. ['{0}']", key); } return _cacheProperties[key]; diff --git a/vsSolutionBuildEvent/UI/WForms/PropertyCheckFrm.cs b/vsSolutionBuildEvent/UI/WForms/PropertyCheckFrm.cs index eebc4e2a..17dc2cc2 100644 --- a/vsSolutionBuildEvent/UI/WForms/PropertyCheckFrm.cs +++ b/vsSolutionBuildEvent/UI/WForms/PropertyCheckFrm.cs @@ -18,6 +18,7 @@ using System; using System.Drawing; using System.Windows.Forms; +using net.r_eg.EvMSBuild; namespace net.r_eg.vsSBE.UI.WForms { @@ -26,7 +27,7 @@ public partial class PropertyCheckFrm: Form /// /// Work with MSBuild /// - private MSBuild.Parser _parser; + private IEvMSBuild _parser; /// /// Flag of sample @@ -35,7 +36,7 @@ public partial class PropertyCheckFrm: Form public PropertyCheckFrm(IEnvironment env) { - _parser = new MSBuild.Parser(env); + _parser = MSBuild.MakeEvaluator(env); InitializeComponent(); Icon = Resource.Package_32; @@ -46,7 +47,7 @@ private void btnEvaluate_Click(object sender, EventArgs e) string evaluated; try { // for a specific project use like this: $($(var):project) - evaluated = _parser.parse(textBoxUnevaluated.Text.Trim()); + evaluated = _parser.Eval(textBoxUnevaluated.Text.Trim()); } catch(Exception ex) { evaluated = String.Format("Fail: {0}", ex.Message); diff --git a/vsSolutionBuildEvent/UI/WForms/ScriptCheckFrm.cs b/vsSolutionBuildEvent/UI/WForms/ScriptCheckFrm.cs index 0406e0cb..c15425f0 100644 --- a/vsSolutionBuildEvent/UI/WForms/ScriptCheckFrm.cs +++ b/vsSolutionBuildEvent/UI/WForms/ScriptCheckFrm.cs @@ -19,18 +19,18 @@ using System.Globalization; using System.Linq; using System.Windows.Forms; -using net.r_eg.vsSBE.MSBuild; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.Scripts; +using net.r_eg.EvMSBuild; +using net.r_eg.SobaScript; +using net.r_eg.SobaScript.Components; +using net.r_eg.SobaScript.Mapper; +using net.r_eg.Varhead; using net.r_eg.vsSBE.UI.WForms.Controls; namespace net.r_eg.vsSBE.UI.WForms { using AvalonEditWPF = ICSharpCode.AvalonEdit.TextEditor; - public partial class ScriptCheckFrm: Form + internal partial class ScriptCheckFrm: Form { /// /// Flag of supporting MSBuild @@ -48,22 +48,22 @@ protected sealed class ToolContext /// /// Container of user-variables /// - public IUserVariable uvariable = new UserVariable(); + public IUVars uvars = new UVars(); /// /// Work with MSBuild /// - public IMSBuild msbuild; + public IEvMSBuild msbuild; /// /// Work with SBE-Scripts /// - public ISBEScript script; + public ISobaScript script; /// /// Loader of the IComponent's /// - public IBootloader bootloader; + public ISobaCLoader cloader; /// /// Mapper of the available components @@ -74,12 +74,13 @@ public ToolContext(IEnvironment env) { Log.Trace("Initialization of the clean context for testing."); - bootloader = new Bootloader(env, uvariable); - bootloader.register(); + var soba = new Soba(MSBuild.MakeEvaluator(env, uvars), uvars); + Bootloader._.Configure(soba); - inspector = new Inspector(bootloader); - script = new Script(bootloader); - msbuild = new MSBuild.Parser(env, uvariable); + cloader = soba; + inspector = new Inspector(soba); + script = soba; + msbuild = soba.EvMSBuild; } } private static ToolContext context; @@ -122,10 +123,10 @@ protected void initEditor() protected void fillComponents() { chkListComponents.Items.Clear(); - foreach(IComponent c in context.bootloader.Registered) + foreach(IComponent c in context.cloader.Registered) { Type type = c.GetType(); - if(!Inspector.isComponent(type)) { + if(!Inspector.IsComponent(type)) { continue; } chkListComponents.Items.Add(type.Name, c.Enabled); @@ -137,7 +138,7 @@ protected void updateComponents(int index = -1, bool newValue = true) for(int i = 0; i < chkListComponents.Items.Count; ++i) { string name = chkListComponents.Items[i].ToString(); - IComponent found = context.bootloader.Registered.Where(c => c.GetType().Name == name).FirstOrDefault(); + IComponent found = context.cloader.Registered.Where(c => c.GetType().Name == name).FirstOrDefault(); if(found != null) { found.Enabled = (index == i)? newValue : chkListComponents.GetItemChecked(i); } @@ -149,7 +150,7 @@ protected void updateVariableList() listBoxUVariables.Items.Clear(); richTextBoxUVariables.Text = String.Empty; - foreach(string var in context.uvariable.Definitions) { + foreach(string var in context.uvars.Definitions) { listBoxUVariables.Items.Add(var); } } @@ -158,7 +159,7 @@ protected string getVariable(string ident) { try { evaluateVariable(ident); - return context.uvariable.get(ident); + return context.uvars.GetValue(ident); } catch(Exception ex) { return String.Format("Fail: {0}", ex.Message); @@ -167,13 +168,13 @@ protected string getVariable(string ident) protected void evaluateVariable(string ident) { - if(!context.uvariable.isUnevaluated(ident)) { + if(!context.uvars.IsUnevaluated(ident)) { return; } - context.uvariable.evaluate(ident, (IEvaluator)context.script, true); + context.uvars.Evaluate(ident, (IEvaluator)context.script, true); if(MSBuildSupport) { - context.uvariable.evaluate(ident, (IEvaluator)context.msbuild, false); + context.uvars.Evaluate(ident, (IEvaluator)context.msbuild, false); } } @@ -182,10 +183,10 @@ protected string execute(string data) try { string ret; if(MSBuildSupport) { - ret = context.msbuild.parse(context.script.parse(data, true)); + ret = context.msbuild.Eval(context.script.Eval(data, true)); } else { - ret = context.script.parse(data); + ret = context.script.Eval(data); } return ret; } @@ -232,13 +233,13 @@ private void menuItemUVarUnsetSel_Click(object sender, EventArgs e) if(listBoxUVariables.SelectedIndex == -1) { return; } - context.uvariable.unset(listBoxUVariables.Text); + context.uvars.Unset(listBoxUVariables.Text); listBoxUVariables.Items.RemoveAt(listBoxUVariables.SelectedIndex); } private void menuItemUVarUnsetAll_Click(object sender, EventArgs e) { - context.uvariable.unsetAll(); + context.uvars.UnsetAll(); listBoxUVariables.Items.Clear(); _lockUVarEditor(richTextBoxUVariables, true); richTextBoxUVariables.Text = String.Empty; @@ -276,7 +277,7 @@ private void richTextBoxUVariables_Leave(object sender, EventArgs e) return; } _lockUVarEditor(richTextBoxUVariables, true); - ((IUserVariableDebug)context.uvariable).debSetEvaluated(listBoxUVariables.Text, richTextBoxUVariables.Text); + ((IUVarsExt)context.uvars).SetEvaluated(listBoxUVariables.Text, richTextBoxUVariables.Text); } private void listBoxUVariables_DoubleClick(object sender, EventArgs e) diff --git a/vsSolutionBuildEvent/UI/WForms/Wizards/Version/Manager.cs b/vsSolutionBuildEvent/UI/WForms/Wizards/Version/Manager.cs index 20c1d22c..d200166d 100644 --- a/vsSolutionBuildEvent/UI/WForms/Wizards/Version/Manager.cs +++ b/vsSolutionBuildEvent/UI/WForms/Wizards/Version/Manager.cs @@ -15,7 +15,9 @@ * along with this program. If not, see . */ +using System; using System.Collections.Generic; +using net.r_eg.EvMSBuild; using net.r_eg.vsSBE.Exceptions; namespace net.r_eg.vsSBE.UI.WForms.Wizards.Version @@ -101,7 +103,7 @@ protected IStep getStep(StepsType type) return steps[type]; } case StepsType.Struct: { - steps[type] = new StepStruct(new MSBuild.Parser(env)) { + steps[type] = new StepStruct(MSBuild.MakeEvaluator(env)) { fnumber = StepStruct.NumberType.NativeStruct }; return steps[type]; @@ -124,7 +126,7 @@ protected IStep getStep(StepsType type) return steps[type]; } } - throw new NotFoundException("getStep: the type - `{0}` is not found.", type); + throw new NotSupportedException($"getStep: the type - `{type}` is not found."); } } } diff --git a/vsSolutionBuildEvent/UI/WForms/Wizards/Version/StepFinal.cs b/vsSolutionBuildEvent/UI/WForms/Wizards/Version/StepFinal.cs index eeceb4c2..f911cdde 100644 --- a/vsSolutionBuildEvent/UI/WForms/Wizards/Version/StepFinal.cs +++ b/vsSolutionBuildEvent/UI/WForms/Wizards/Version/StepFinal.cs @@ -19,6 +19,7 @@ using System.Collections.Generic; using System.Globalization; using System.Text; +using net.r_eg.SobaScript.Exceptions; using net.r_eg.vsSBE.Exceptions; namespace net.r_eg.vsSBE.UI.WForms.Wizards.Version @@ -100,7 +101,7 @@ public string construct() return genDirect(); } } - throw new NotFoundException("The '{0}' is not found to construct the final step.", req.StepGen.gtype); + throw new NotFoundException(req.StepGen.gtype, $"The '{req.StepGen.gtype}' is not found to construct the final step."); } /// Manager of used steps for generation. @@ -210,7 +211,7 @@ protected string scRevision() return Resource.ScriptRevisionRaw + LINE_BREAK; } } - throw new NotFoundException("scRevision: the `{0}` is not supported.", req.StepCfgData.revType); + throw new NotFoundException(req.StepCfgData.revType, $"scRevision: the `{req.StepCfgData.revType}` is not supported."); } /// @@ -390,9 +391,9 @@ protected string scScmDirect(Fields.Type type, out string fieldName) return String.Format("{0}{1}{2}", scm, LINE_BREAK, val); } } - throw new NotFoundException("The `{0}` is not found for used scm `git`.", type); + throw new NotFoundException(type, $"The `{type}` is not found for used scm `git`."); } - throw new NotFoundException("The `{0}` is not found for handling scm data.", req.StepCfgData.scm); + throw new NotFoundException(req.StepCfgData.scm, $"The `{req.StepCfgData.scm}` is not found for handling scm data."); } /// @@ -418,7 +419,7 @@ protected string scVersionDirect(Fields.Type type, out string fieldName) return String.Format(tpl, fieldName, "$(ver).$(Revision)"); } } - throw new NotFoundException("The `{0}` is not found for single variable from version-fields.", type); + throw new NotFoundException(type, $"The `{type}` is not found for single variable from version-fields."); } /// diff --git a/vsSolutionBuildEvent/UI/WForms/Wizards/Version/StepStruct.cs b/vsSolutionBuildEvent/UI/WForms/Wizards/Version/StepStruct.cs index 390c7b73..a4aa8eb9 100644 --- a/vsSolutionBuildEvent/UI/WForms/Wizards/Version/StepStruct.cs +++ b/vsSolutionBuildEvent/UI/WForms/Wizards/Version/StepStruct.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Generic; +using net.r_eg.EvMSBuild; using net.r_eg.MvsSln; namespace net.r_eg.vsSBE.UI.WForms.Wizards.Version @@ -90,11 +91,11 @@ public StepStruct() } /// - public StepStruct(MSBuild.Parser parser) + public StepStruct(IEvMSBuild parser) : this() { try { - namspace = parser.getProperty(PropertyNames.PRJ_NAMESPACE); + namspace = parser.GetPropValue(PropertyNames.PRJ_NAMESPACE); } catch(Exception ex) { Log.Debug("Wizard-Version: RootNamespace failed - `{0}`", ex.Message); diff --git a/vsSolutionBuildEvent/UI/WForms/Wizards/VersionFrm.cs b/vsSolutionBuildEvent/UI/WForms/Wizards/VersionFrm.cs index 03839275..96a120a9 100644 --- a/vsSolutionBuildEvent/UI/WForms/Wizards/VersionFrm.cs +++ b/vsSolutionBuildEvent/UI/WForms/Wizards/VersionFrm.cs @@ -19,17 +19,17 @@ using System.Drawing; using System.Linq; using System.Windows.Forms; +using net.r_eg.MvsSln.Extensions; +using net.r_eg.SobaScript.Exceptions; +using net.r_eg.SobaScript.Mapper; using net.r_eg.vsSBE.Events; -using net.r_eg.vsSBE.Exceptions; using net.r_eg.vsSBE.Extensions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Dom; using net.r_eg.vsSBE.UI.WForms.Controls; using net.r_eg.vsSBE.UI.WForms.Wizards.Version; namespace net.r_eg.vsSBE.UI.WForms.Wizards { - public partial class VersionFrm: Form + internal partial class VersionFrm: Form { /// /// Manager of steps. @@ -41,11 +41,11 @@ public partial class VersionFrm: Form /// private ITransfer _pin; - /// + /// /// - public VersionFrm(IBootloader bootloader, ITransfer pin) + public VersionFrm(Bootloader loader, ITransfer pin) { - manager = new Manager(bootloader.Env); + manager = new Manager(loader.Env); _pin = pin; InitializeComponent(); @@ -57,7 +57,7 @@ public VersionFrm(IBootloader bootloader, ITransfer pin) editorStepGen.setBackgroundFromString("#F4F4F4"); editorFinalScript.colorize(TextEditor.ColorSchema.SBEScripts); - editorFinalScript.codeCompletionInit(new Inspector(bootloader), new MSBuild.Parser(bootloader.Env, bootloader.UVariable)); + editorFinalScript.codeCompletionInit(new Inspector(loader.Soba), loader.Soba.EvMSBuild); editorFinalScript.CodeCompletionEnabled = true; editorFinalScript._.WordWrap = false; @@ -67,11 +67,11 @@ public VersionFrm(IBootloader bootloader, ITransfer pin) tcReplType.SizeMode = TabSizeMode.Fixed; btnPrevStep.Visible = false; - string spath = bootloader.Env.SolutionPath ?? Settings.WPath; + string spath = loader.Env.SolutionPath ?? Settings.WPath; ftbInputNum.Dialog.InitialDirectory = ftbOutputFile.Dialog.InitialDirectory = ftbReplFile.Dialog.InitialDirectory - = spath.PathFormat(); + = spath.DirectoryPathFormat(); } private void render(StepsType type) @@ -394,7 +394,7 @@ private StepsType getStepTypeBy(TabPage page) if(page == tabPageFinal) { return StepsType.Final; } - throw new NotFoundException("getStepTypeBy: the page - `{0}` is not found.", page.Name); + throw new NotFoundException(page.Name); } private void nextStep() diff --git a/vsSolutionBuildEvent/UserConfig.cs b/vsSolutionBuildEvent/UserConfig.cs index ba716aef..4b5977bf 100644 --- a/vsSolutionBuildEvent/UserConfig.cs +++ b/vsSolutionBuildEvent/UserConfig.cs @@ -140,7 +140,7 @@ protected virtual bool loadByLink(string link) { Data = deserialize(stream); if(Data == null) { - throw new SBEException("file is empty"); + throw new UnspecSBEException("file is empty"); } } Log.Trace("User settings: has been loaded from '{0}'", link); diff --git a/vsSolutionBuildEvent/packages.config b/vsSolutionBuildEvent/packages.config index a911a3a3..1c258886 100644 --- a/vsSolutionBuildEvent/packages.config +++ b/vsSolutionBuildEvent/packages.config @@ -3,6 +3,7 @@ + diff --git a/vsSolutionBuildEvent/vsSolutionBuildEvent.csproj b/vsSolutionBuildEvent/vsSolutionBuildEvent.csproj index a53930d9..d795dd51 100644 --- a/vsSolutionBuildEvent/vsSolutionBuildEvent.csproj +++ b/vsSolutionBuildEvent/vsSolutionBuildEvent.csproj @@ -112,12 +112,14 @@ prompt MinimumRecommendedRules.ruleset + + true + ..\packages\AvalonEdit.5.0.4\lib\Net40\ICSharpCode.AvalonEdit.dll True - @@ -143,7 +145,7 @@ - + ..\packages\EnvDTE.8.0.2\lib\net10\EnvDTE.dll @@ -159,6 +161,10 @@ ..\packages\stdole.7.0.3303\lib\net10\stdole.dll True + + ..\packages\Microsoft.Build.16.0.461\lib\net472\Microsoft.Build.Framework.dll + True + ..\packages\Microsoft.Build.Framework.16.0.461\lib\netstandard2.0\Microsoft.Build.Framework.dll True @@ -229,7 +235,7 @@ - + False @@ -245,6 +251,7 @@ ..\packages\vsSBE.SDK.$(vsSBE_SDK)\lib\net40\stdole.dll True + ..\packages\vsSBE.SDK.$(vsSBE_SDK)\lib\net40\Microsoft.VisualStudio.OLE.Interop.dll @@ -295,9 +302,8 @@ - + - @@ -305,6 +311,8 @@ + + @@ -315,7 +323,13 @@ + + + + + + @@ -340,32 +354,12 @@ - - - - - - - - - - - - - - - - - - - - UserControl @@ -460,81 +454,32 @@ - - - - - - - - - - - - - - - - - - - - - + True True - Icon.resx + DomIcon.resx - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + @@ -544,18 +489,7 @@ - - - - - - - - - - - @@ -604,11 +538,8 @@ PropertiesFrm.cs - - - @@ -663,9 +594,9 @@ - + ResXFileCodeGenerator - Icon.Designer.cs + DomIcon.Designer.cs ResXFileCodeGenerator @@ -811,10 +742,58 @@ {73919171-44B6-4536-B892-F1FCA653887C} Bridge + + {e51d1ea3-f4a7-4f27-a941-e16d2b88d08a} + E-MSBuild + TargetFramework=net40 + TargetFramework=netstandard2.0 + + + {287d8f67-dd08-423f-aa60-c48d84140612} + LSender + TargetFramework=net40 + TargetFramework=netstandard2.0 + {f905dfb2-2e67-4ff7-9001-924f6f2d645d} MvsSln + + {3eabd66d-1f4b-46e5-88ff-3e680708309f} + SobaScript.Mapper + TargetFramework=net40 + TargetFramework=netstandard2.0 + + + {d5c9a407-1173-43bf-a15a-5d8ab100ac4a} + SobaScript.Z.Core + TargetFramework=net40 + TargetFramework=netstandard2.0 + + + {0fb9bd48-d455-40dc-a6bf-411b595a2999} + SobaScript.Z.Ext + TargetFramework=net40 + TargetFramework=netstandard2.0 + + + {cd42837f-ecb4-48d5-89d5-eff831001f89} + SobaScript.Z.VS + TargetFramework=net40 + TargetFramework=netstandard2.0 + + + {3a80b650-b457-4de4-b2d3-64191a20c6b7} + SobaScript + TargetFramework=net40 + TargetFramework=netstandard2.0 + + + {4670b9b4-1ba9-4cb2-bbfc-ec4ebeb40a42} + Varhead + TargetFramework=net40 + TargetFramework=netstandard2.0 + true @@ -845,6 +824,13 @@ true PreserveNewest + + x64\ + false + %(Filename)%(Extension) + true + PreserveNewest + false %(Filename)%(Extension) @@ -853,7 +839,7 @@ - + $(NoWarn);IDE1003 diff --git a/vsSolutionBuildEventTest/Actions/DTEOperationTest.cs b/vsSolutionBuildEventTest/Actions/DTEOperationTest.cs index e4eaeeeb..64d10059 100644 --- a/vsSolutionBuildEventTest/Actions/DTEOperationTest.cs +++ b/vsSolutionBuildEventTest/Actions/DTEOperationTest.cs @@ -1,41 +1,17 @@ using System; using System.Collections.Generic; +using System.Runtime.InteropServices; using Microsoft.VisualStudio.TestTools.UnitTesting; +using net.r_eg.EvMSBuild.Exceptions; using net.r_eg.vsSBE.Actions; using net.r_eg.vsSBE.Events; -using net.r_eg.vsSBE.Exceptions; namespace net.r_eg.vsSBE.Test.Actions { - /// - ///This is a test class for DTEOperationTest and is intended - ///to contain all DTEOperationTest Unit Tests - /// - [TestClass()] + [TestClass] public class DTEOperationTest { - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - /// - ///A test for DTEPrepared - /// - [TestMethod()] + [TestMethod] public void dtePreparedTest() { DTEOperation target = new DTEOperation((IEnvironment)null, SolutionEventType.General); @@ -47,10 +23,7 @@ public void dtePreparedTest() Assert.AreEqual("\"c:\\path\\app.sln\"", actual.args); } - /// - ///A test for DTEPrepared - /// - [TestMethod()] + [TestMethod] public void dtePreparedTest2() { DTEOperation target = new DTEOperation((IEnvironment)null, SolutionEventType.General); @@ -62,10 +35,7 @@ public void dtePreparedTest2() Assert.AreEqual("", actual.args); } - /// - ///A test for DTEPrepared - /// - [TestMethod()] + [TestMethod] [ExpectedException(typeof(IncorrectSyntaxException))] public void dtePreparedTest3() { @@ -75,10 +45,7 @@ public void dtePreparedTest3() DTEOperation.DTEPrepared actual = target.parse(line); } - /// - ///A test for DTEPrepared - /// - [TestMethod()] + [TestMethod] [ExpectedException(typeof(IncorrectSyntaxException))] public void dtePreparedTest4() { @@ -88,10 +55,7 @@ public void dtePreparedTest4() DTEOperation.DTEPrepared actual = target.parse(line); } - /// - ///A test for DTEPrepared - /// - [TestMethod()] + [TestMethod] public void dtePreparedTest5() { DTEOperation target = new DTEOperation((IEnvironment)null, SolutionEventType.General); @@ -103,10 +67,7 @@ public void dtePreparedTest5() Assert.AreEqual("arg", actual.args); } - /// - ///A test for exec - /// - [TestMethod()] + [TestMethod] public void execTest() { DTEOperationAccessor.ToExec target = new DTEOperationAccessor.ToExec(-1); @@ -125,14 +86,11 @@ public void execTest() Assert.IsTrue(actual.Count == expected.Length); foreach(DTEOperation.DTEPrepared obj in expected) { - Assert.AreEqual(actual.Dequeue(), obj); + Assert.AreEqual(actual.Dequeue(), obj); } } - /// - ///A test for exec - /// - [TestMethod()] + [TestMethod] public void execTest2() { DTEOperationAccessor.ToExec target = new DTEOperationAccessor.ToExec(1); @@ -148,7 +106,7 @@ public void execTest2() try { target.exec(commands, false); } - catch(ComponentException) { + catch(ExternalException) { // other type should fail the current test } @@ -160,10 +118,7 @@ public void execTest2() } } - /// - ///A test for exec - /// - [TestMethod()] + [TestMethod] public void execTest3() { DTEOperationAccessor.ToExec target = new DTEOperationAccessor.ToExec(2); @@ -180,7 +135,7 @@ public void execTest3() try { target.exec(commands, true); } - catch(ComponentException) { + catch(ExternalException) { // other type should fail the current test } diff --git a/vsSolutionBuildEventTest/MSBuild/ParserTest.cs b/vsSolutionBuildEventTest/MSBuild/ParserTest.cs index a3ae7fda..922a571c 100644 --- a/vsSolutionBuildEventTest/MSBuild/ParserTest.cs +++ b/vsSolutionBuildEventTest/MSBuild/ParserTest.cs @@ -1,12 +1,7 @@ -using System; -using System.Linq; -using EnvDTE80; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using net.r_eg.EvMSBuild; using net.r_eg.MvsSln; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.MSBuild; -using net.r_eg.vsSBE.Scripts; namespace net.r_eg.vsSBE.Test.MSBuild { @@ -28,1224 +23,9 @@ public void getPropertyTest() mockSolution.SetupGet(p => p.SolutionBuild).Returns(mockSolutionBuild.Object); mockDte2.SetupGet(p => p.Solution).Returns(mockSolution.Object); - Parser target = new Parser(new net.r_eg.vsSBE.Environment(mockDte2.Object)); - Assert.IsNotNull(target.getProperty(PropertyNames.CONFIG)); - Assert.IsNotNull(target.getProperty(PropertyNames.PLATFORM)); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest1() - { - Parser target = new Parser(new StubEnv()); - - string actual = target.parse("FooBar"); - string expected = "FooBar"; - - Assert.AreEqual(expected, actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest2() - { - string data = "$(Path)"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("[P~Path~]", actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest3() - { - string data = "$$(Path)"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("$(Path)", actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest4() - { - string data = "$$$(Path)"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("$$(Path)", actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest5() - { - string data = "(Path)"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("(Path)", actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest6() - { - string data = "$(Path:project)"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("[P~Path~project]", actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest7() - { - string data = "$$(Path:project)"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("$(Path:project)", actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest8() - { - string data = "$([System.DateTime]::UtcNow.Ticks)"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("[E~[System.DateTime]::UtcNow.Ticks~]", actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest9() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(Path.Replace('\\\\', '/'))"; - Assert.AreEqual("[E~Path.Replace('\\\\', '/')~]", target.parse(data)); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest10() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(Path.Replace('\\', '/'))"; - Assert.AreEqual("[E~Path.Replace('\\', '/')~]", target.parse(data)); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest11() - { - string data = "$(ProjectDir.Replace('\\', '/'):client)"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("[E~ProjectDir.Replace('\\', '/')~client]", actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest12() - { - Parser target = new Parser(new StubEnv()); - - string actual = target.parse("$$(Path.Replace('\', '/'):project)"); - string expected = "$(Path.Replace('\', '/'):project)"; - - Assert.AreEqual(expected, actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest13() - { - string data = "$(ProjectDir.Replace(\"str1\", \"str2\"))"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("[E~ProjectDir.Replace(\"str1\", \"str2\")~]", actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest14() - { - string data = "$(ProjectDir.Replace('str1', 'str2'))"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("[E~ProjectDir.Replace('str1', 'str2')~]", actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest15() - { - string data = "$(var.Method('~str~', $(OS:$($(data):project2)), \"~str2~\"):project)"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("[E~var.Method('~str~', [P~OS~[E~[P~data~]~project2]], \"~str2~\")~project]", actual); - } - - /// - ///A test for parse - Wrapping - /// - [TestMethod()] - public void parseWrappingTest1() - { - string data = "$($(ProjectDir.Replace('\\', '/'):client))"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("[E~[E~ProjectDir.Replace('\\', '/')~client]~]", actual); - } - - /// - ///A test for parse - Wrapping - /// - [TestMethod()] - public void parseWrappingTest2() - { - string data = "$($(ProjectDir.Replace('\\', '/')))"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("[E~[E~ProjectDir.Replace('\\', '/')~]~]", actual); - } - - /// - ///A test for parse - Wrapping - /// - [TestMethod()] - public void parseWrappingTest3() - { - string data = "$($(var.Method('str', $(OS))):$(var.Method('str2', $(SO))))"; - string actual = (new MSBuildParserAccessor.ToParse()).parse(data); - Assert.AreEqual("[E~[E~var.Method('str', [P~OS~])~]:[E~var.Method('str2', [P~SO~])~]~]", actual); - } - - /// - ///A test for parse - Wrapping - /// - [TestMethod()] - public void parseWrappingTest4() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$($(Path:project))"; - string actual = target.parse(data); - Assert.IsTrue("[E~[P~Path~project]~]" == actual || "[P~[P~Path~project]~]" == actual); - } - - /// - ///A test for parse - Variable & data - /// - [TestMethod()] - public void parseVarAndDataTest1() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var=$(Path.Replace('\\', '/')):project)"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual(null, target.uvariable.get("var")); - Assert.AreEqual("[E~Path.Replace('\\', '/')~]", target.uvariable.get("var", "project")); - } - - /// - ///A test for parse - Variable & data - /// - [TestMethod()] - public void parseVarAndDataTest2() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var = $$(Path:project))"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("$(Path:project)", target.uvariable.get("var")); - } - - /// - ///A test for parse - Variable & data - /// - [TestMethod()] - public void parseVarAndDataTest3() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$$(var = $$(Path:project))"; - Assert.AreEqual("$(var = $$(Path:project))", target.parse(data)); - } - - /// - ///A test for parse - Variable & data - /// - [TestMethod()] - public void parseVarAndDataTest4() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$$(var = $(Path:project))"; - Assert.AreEqual("$(var = $(Path:project))", target.parse(data)); - } - - /// - ///A test for parse - Variable & data - /// - [TestMethod()] - public void parseVarAndDataTest5() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var = $(Path:project))"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("[P~Path~project]", target.uvariable.get("var")); - } - - /// - ///A test for parse - Variable & data - /// - [TestMethod()] - public void parseVarAndDataTest6() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var=$(Path:project2):project)"; - - Assert.IsTrue(target.uvariable.Variables.Count() < 1); - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("[P~Path~project2]", target.uvariable.get("var", "project")); - Assert.IsTrue(target.uvariable.Variables.Count() == 1); - } - - /// - ///A test for parse - Variable & data - /// - [TestMethod()] - public void parseVarAndDataTest7() - { - MSBuildParserAccessor.ToUserVariables target = new MSBuildParserAccessor.ToUserVariables(); - - target.uvariable.set("var", "project", "is a Windows_NT"); //"$(var.Replace('%OS%', $(OS)):project)"; - - string actual = target.parse("$(var:project)"); - Assert.AreEqual("is a Windows_NT", actual); - } - - /// - ///A test for parse - Escape & Variable - /// - [TestMethod()] - public void parseEscapeAndVarTest1() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - /* - $(p1 = $(Platform)) - $(p2 = $(p1)) - $(p2) - */ - string data = "$(p1 = $(Platform))$(p2 = $(p1))$(p2)"; - Assert.AreEqual("[P~Platform~]", target.parse(data)); - Assert.AreEqual("[P~Platform~]", target.uvariable.get("p1")); - Assert.AreEqual("[P~Platform~]", target.uvariable.get("p2")); - } - - /// - ///A test for parse - Escape & Variable - /// - [TestMethod()] - public void parseEscapeAndVarTest2() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - /* - $(p1 = $(Platform)) - $(p2 = $$(p1)) - $(p2) - */ - string data = "$(p1 = $(Platform))$(p2 = $$(p1))$(p2)"; - Assert.AreEqual("[P~Platform~]", target.parse(data)); - Assert.AreEqual("[P~Platform~]", target.uvariable.get("p1")); - Assert.AreEqual("$(p1)", target.uvariable.get("p2")); - } - - - /// - ///A test for parse - Escape & Variable - /// - [TestMethod()] - public void parseEscapeAndVarTest3() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - /* - $(p1 = $(Platform)) - $(p2 = $$$(p1)) - $(p2) - */ - string data = "$(p1 = $(Platform))$(p2 = $$$(p1))$(p2)"; - Assert.AreEqual("$(p1)", target.parse(data)); - Assert.AreEqual("[P~Platform~]", target.uvariable.get("p1")); - Assert.AreEqual("$$(p1)", target.uvariable.get("p2")); - } - - /// - ///A test for parse - Escape & Variable - /// - [TestMethod()] - public void parseEscapeAndVarTest4() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - /* - $(p1 = $(Platform)) - $(p2 = $$$$(p1)) - $(p2) - */ - string data = "$(p1 = $(Platform))$(p2 = $$$$(p1))$(p2)"; - Assert.AreEqual("$$(p1)", target.parse(data)); - Assert.AreEqual("[P~Platform~]", target.uvariable.get("p1")); - Assert.AreEqual("$$$(p1)", target.uvariable.get("p2")); - } - - /// - ///A test for parse - Escape & Variable - /// - [TestMethod()] - public void parseEscapeAndVarTest5() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(p2 = $(Platform))"; - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("[P~Platform~]", target.uvariable.get("p2")); - } - - /// - ///A test for parse - Escape & Variable - /// - [TestMethod()] - public void parseEscapeAndVarTest6() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(p2 = $$(Platform))"; - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("$(Platform)", target.uvariable.get("p2")); - } - - /// - ///A test for parse - Escape & Variable - /// - [TestMethod()] - public void parseEscapeAndVarTest7() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(p2 = $$$(Platform))"; - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("$$(Platform)", target.uvariable.get("p2")); - } - - /// - ///A test for parse - Escape & Variable - /// - [TestMethod()] - public void parseEscapeAndVarTest8() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(p2 = $$$$(Platform))"; - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("$$$(Platform)", target.uvariable.get("p2")); - } - - /// - ///A test for parse - Escape & Variable - /// - [TestMethod()] - public void parseEscapeAndVarTest9() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - /* - $(p1 = $(Platform)) - $(p1) - */ - string data = "$(p1 = $(Platform))$(p1)"; - Assert.AreEqual("[P~Platform~]", target.parse(data)); - Assert.AreEqual("[P~Platform~]", target.uvariable.get("p1")); - } - - /// - ///A test for parse - Escape & Variable - /// - [TestMethod()] - public void parseEscapeAndVarTest10() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - /* - $(p1 = $(Platform)) - $$(p1) - */ - string data = "$(p1 = $(Platform))$$(p1)"; - Assert.AreEqual("$(p1)", target.parse(data)); - Assert.AreEqual("[P~Platform~]", target.uvariable.get("p1")); - } - - /// - ///A test for parse - string - /// - [TestMethod()] - public void parseStringTest1() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var = \"$(Path:project)\")"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("[P~Path~project]", target.uvariable.get("var")); - } - - /// - ///A test for parse - string - /// - [TestMethod()] - public void parseStringTest2() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var = \" mixed $(Path:project) \" )"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual(" mixed [P~Path~project] ", target.uvariable.get("var")); - } - - /// - ///A test for parse - string - /// - [TestMethod()] - public void parseStringTest3() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - Assert.AreEqual(String.Empty, target.parse("$(var = \" $$(Path:project) \")")); - Assert.AreEqual(" $(Path:project) ", target.uvariable.get("var")); - - Assert.AreEqual(String.Empty, target.parse("$(var = ' $$(Path:project) ')")); - Assert.AreEqual(" $$(Path:project) ", target.uvariable.get("var")); - } - - /// - ///A test for parse - string - /// - [TestMethod()] - public void parseStringTest4() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var = ' $(Path:project) ')"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual(" $(Path:project) ", target.uvariable.get("var")); - } - - /// - ///A test for parse - string - /// - [TestMethod()] - public void parseStringTest5() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = @"$(var = '$(Path.Replace(\'1\', \'2\'))')"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("$(Path.Replace('1', '2'))", target.uvariable.get("var")); - } - - /// - ///A test for parse - string - /// - [TestMethod()] - public void parseStringTest6() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var = '$(Path.Replace(\\\"1\\\", \\\"2\\\"))')"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("$(Path.Replace(\\\"1\\\", \\\"2\\\"))", target.uvariable.get("var")); - } - - /// - ///A test for parse - string - /// - [TestMethod()] - public void parseStringTest7() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var = \"$(Path.Replace(\\'1\\', \\'2\\'))\")"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("[E~Path.Replace(\\'1\\', \\'2\\')~]", target.uvariable.get("var")); - } - - /// - ///A test for parse - string - /// - [TestMethod()] - public void parseStringTest8() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var = \"$(Path.Replace(\\\"1\\\", \\\"2\\\"))\")"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("[E~Path.Replace(\"1\", \"2\")~]", target.uvariable.get("var")); - } - - /// - ///A test for parse - string - /// - [TestMethod()] - public void parseStringTest9() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = @"$(var = $(Path.Replace(\'1\', '2')))"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual(@"[E~Path.Replace(\'1\', '2')~]", target.uvariable.get("var")); - } - - /// - ///A test for parse - string - /// - [TestMethod()] - public void parseStringTest10() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var = $(Path.Replace(\\\"1\\\", \"2\")))"; - - Assert.AreEqual("", target.parse(data)); - Assert.AreEqual("[E~Path.Replace(\\\"1\\\", \"2\")~]", target.uvariable.get("var")); - } - - /// - ///A test for parse - string - /// - [TestMethod()] - public void parseStringTest11() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - Assert.AreEqual("", target.parse("$(name = ' test 12345 -_*~!@#$%^&= :) ')")); - Assert.AreEqual(" test 12345 -_*~!@#$%^&= :) ", target.uvariable.get("name")); - - Assert.AreEqual("", target.parse("$(name = ' $( -_*~!@#$%^&= :) ')")); - Assert.AreEqual(" $( -_*~!@#$%^&= :) ", target.uvariable.get("name")); - } - - /// - ///A test for parse - string - /// - [TestMethod] - public void parseStringTest12() - { - var target = new MSBuildParserAccessor.ToParse(); - - Assert.AreEqual(String.Empty, target.parse("$(name = 'left\\'right')")); - Assert.AreEqual("left'right", target.uvariable.get("name")); - - Assert.AreEqual(String.Empty, target.parse("$(name = \"left\\'right\")")); - Assert.AreEqual("left\\'right", target.uvariable.get("name")); - - Assert.AreEqual(String.Empty, target.parse("$(name = 'left\\\"right')")); - Assert.AreEqual("left\\\"right", target.uvariable.get("name")); - - Assert.AreEqual(String.Empty, target.parse("$(name = \"left\\\"right\")")); - Assert.AreEqual("left\"right", target.uvariable.get("name")); - } - - /// - ///A test for parse - string - /// - [TestMethod] - [ExpectedException(typeof(IncorrectSyntaxException))] - public void parseStringTest13() - { - var target = new MSBuildParserAccessor.ToParse(); - target.parse("$(name = 'left'right')"); - } - - /// - ///A test for parse - string - /// - [TestMethod] - [ExpectedException(typeof(IncorrectSyntaxException))] - public void parseStringTest14() - { - var target = new MSBuildParserAccessor.ToParse(); - target.parse("$(name = \"left\"right\")"); - } - - /// - ///A test for parse - string - /// - [TestMethod] - public void parseStringTest15() - { - var target = new MSBuildParserAccessor.ToParse(); - - Assert.AreEqual(String.Empty, target.parse("$(name = \" left $(Path:project) right \" )")); - Assert.AreEqual(" left [P~Path~project] right ", target.uvariable.get("name")); - - Assert.AreEqual(String.Empty, target.parse("$(name = \" left \\\"$(Path)\\\" right \" )")); - Assert.AreEqual(" left \"[P~Path~]\" right ", target.uvariable.get("name")); - - Assert.AreEqual(String.Empty, target.parse("$(name = \" \\'left\\' $(Path:project) 'right' \" )")); - Assert.AreEqual(" \\'left\\' [P~Path~project] 'right' ", target.uvariable.get("name")); - } - - [TestMethod] - public void vtSignTest1() - { - var uvar = new UserVariable(); - var target = new Parser(new StubEnv(), uvar); - - Assert.AreEqual(String.Empty, target.parse("$(+name = 'myvar')")); - Assert.AreEqual("myvar", uvar.get("name")); - - Assert.AreEqual(String.Empty, target.parse("$(+name += '12')")); - Assert.AreEqual("myvar12", uvar.get("name")); - - Assert.AreEqual(String.Empty, target.parse("$(name += '34')")); - Assert.AreEqual("myvar1234", uvar.get("name")); - } - - [TestMethod] - public void vtSignTest2() - { - var uvar = new UserVariable(); - var target = new Parser(new StubEnv(), uvar); - - Assert.AreEqual(String.Empty, target.parse("$(i = 0)")); - Assert.AreEqual(String.Empty, target.parse("$(i += 1)")); - Assert.AreEqual(String.Empty, target.parse("$(i += 2)$(i += 1)")); - Assert.AreEqual(String.Empty, target.parse("$(i -= 2)")); - Assert.AreEqual("2", uvar.get("i")); - } - - [TestMethod] - public void vtSignTest3() - { - var uvar = new UserVariable(); - var target = new Parser(new StubEnv(), uvar); - - Assert.AreEqual(String.Empty, target.parse("$(i += 1)")); - Assert.AreEqual("1", uvar.get("i")); - - Assert.AreEqual(String.Empty, target.parse("$(j -= 1)")); - Assert.AreEqual("-1", uvar.get("j")); - } - - [TestMethod] - [ExpectedException(typeof(InvalidArgumentException))] - public void vtSignTest4() - { - var uvar = new UserVariable(); - var target = new Parser(new StubEnv(), uvar); - - Assert.AreEqual(String.Empty, target.parse("$(i = \"test\")")); - Assert.AreEqual(String.Empty, target.parse("$(i += 1)")); - Assert.AreEqual("test1", uvar.get("i")); - - target.parse("$(i -= 1)"); - } - - [TestMethod] - public void vtSignTest5() - { - var uvar = new UserVariable(); - var target = new Parser(new StubEnv(), uvar); - - Assert.AreEqual(String.Empty, target.parse("$(i = 1)")); - Assert.AreEqual(String.Empty, target.parse("$(i += $(i))")); - Assert.AreEqual("2", uvar.get("i")); - - //TODO: currently std. exception: - try { - Assert.AreEqual(String.Empty, target.parse("$(i += 'test')")); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(true /*ex.GetType() == typeof(NotFoundException)*/, ex.GetType().ToString()); } - } - - /// - ///A test for parse - nested - /// - [TestMethod()] - public void parseNestedTest1() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = @"$(var.Method('str1', $(OS:$($(data.Replace('\', '/')):project2)), 'str2'):project)"; - Assert.AreEqual(@"[E~var.Method('str1', [E~OS:[E~[E~data.Replace('\', '/')~]~project2]~], 'str2')~project]", target.parse(data)); - } - - /// - ///A test for parse - nested - /// - [TestMethod()] - public void parseNestedTest2() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = @"$(var.Method('str1', $(OS:$($(data.Method2):project2)), 'str2'):project)"; - Assert.AreEqual(@"[E~var.Method('str1', [P~OS~[E~[E~data.Method2~]~project2]], 'str2')~project]", target.parse(data)); - } - - /// - ///A test for parse - nested - /// - [TestMethod()] - public void parseNestedTest3() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var.Method('str1', $(OS:$($([System.DateTime]::Parse(\"27.03.2015\").ToBinary()):project2)), 'str2'):project)"; - Assert.AreEqual("[E~var.Method('str1', [E~OS:[E~[E~[System.DateTime]::Parse(\"27.03.2015\").ToBinary()~]~project2]~], 'str2')~project]", target.parse(data)); - } - - /// - ///A test for parse - nested - /// - [TestMethod()] - public void parseNestedTest4() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var.Method('str1', $(OS:$($(test.Ticks):project2)), \\\"str2\\\"):project)"; - Assert.AreEqual("[E~var.Method('str1', [P~OS~[E~[E~test.Ticks~]~project2]], \\\"str2\\\")~project]", target.parse(data)); - } - - /// - ///A test for parse - nested - /// - [TestMethod()] - public void parseNestedTest5() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$(var.Method('str1', $(OS:$($(data):project2)), \\\"str2\\\"):project)"; - string actual = target.parse(data); - Assert.IsTrue("[E~var.Method('str1', [P~OS~[E~[P~data~]~project2]], \\\"str2\\\")~project]" == actual - || "[E~var.Method('str1', [P~OS~[P~[P~data~]~project2]], \\\"str2\\\")~project]" == actual); - } - - /// - ///A test for parse - nested - /// - [TestMethod()] - public void parseNestedTest6() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$([System.DateTime]::Parse(\"01.01.2000\").ToBinary())"; - Assert.AreEqual("[E~[System.DateTime]::Parse(\"01.01.2000\").ToBinary()~]", target.parse(data)); - } - - /// - ///A test for parse - nested - /// - [TestMethod()] - public void parseNestedTest7() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$([System.DateTime]::Parse(\" left $([System.DateTime]::UtcNow.Ticks) right\").ToBinary())"; - Assert.AreEqual("[E~[System.DateTime]::Parse(\" left [E~[System.DateTime]::UtcNow.Ticks~] right\").ToBinary()~]", target.parse(data)); - } - - /// - ///A test for parse - nested - /// - [TestMethod()] - public void parseNestedTest8() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$([System.DateTime]::Parse(' left $([System.DateTime]::UtcNow.Ticks) right').ToBinary())"; - Assert.AreEqual("[E~[System.DateTime]::Parse(' left $([System.DateTime]::UtcNow.Ticks) right').ToBinary()~]", target.parse(data)); - } - - /// - ///A test for parse - nested - /// - [TestMethod()] - public void parseNestedTest9() - { - MSBuildParserAccessor.ToParse target = new MSBuildParserAccessor.ToParse(); - - string data = "$([System.TimeSpan]::FromTicks($([MSBuild]::Subtract($([System.DateTime]::UtcNow.Ticks), $([System.DateTime]::Parse('27.03.2015').ToBinary())))).TotalMinutes.ToString(\"0\"))"; - Assert.AreEqual("[E~[System.TimeSpan]::FromTicks([E~[MSBuild]::Subtract([E~[System.DateTime]::UtcNow.Ticks~], [E~[System.DateTime]::Parse('27.03.2015').ToBinary()~])~]).TotalMinutes.ToString(\"0\")~]", target.parse(data)); - } - - /// - ///A test for parse - unlooping - /// - [TestMethod()] - public void parseUnloopingTest1() - { - var target = new Parser(new StubEnv()); - - string data = "$(myVar = $$(myVar))$(myVar)"; - Assert.AreEqual("$(myVar)", target.parse(data)); - } - - /// - ///A test for parse - unlooping - /// - [TestMethod()] - public void parseUnloopingTest2() - { - var target = new Parser(new StubEnv()); - - string data = "$(myVar = $(myVar))$(myVar)"; - Assert.AreEqual(Parser.PROP_VALUE_DEFAULT, target.parse(data)); - } - - /// - ///A test for parse - unlooping - /// - [TestMethod()] - [ExpectedException(typeof(Exceptions.LimitException))] - public void parseUnloopingTest3() - { - var target = new Parser(new StubEnv()); - // p1 -> p2 -> p1 ] p3 -> p2 - target.parse("$(p1 = $$(p2))$(p2 = $$(p1))$(p3 = $(p2))"); - } - - /// - ///A test for parse - unlooping - /// - [TestMethod()] - [ExpectedException(typeof(Exceptions.LimitException))] - public void parseUnloopingTest4() - { - var target = new Parser(new StubEnv()); - // p4 -> p2 -> p3 -> p1 -> p4 - target.parse("$(p4 = $$(p2))$(p3 = $$(p1))$(p2 = $$(p3))$(p1 = $$(p4))$(p4)"); - } - - /// - ///A test for parse - unlooping - /// - [TestMethod()] - public void parseUnloopingTest5() - { - var target = new Parser(new StubEnv()); - Assert.AreEqual(Parser.PROP_VALUE_DEFAULT, target.parse("$(p2 = $$(p1))$(p6 = $$(p2))$(p7 = $$(p5))$(p5 = $(p6))$(p5)")); - } - - /// - ///A test for parse - unlooping - /// - [TestMethod()] - public void parseUnloopingTest6() - { - var target = new Parser(new StubEnv()); - target.parse("$(p2 = \"$$(p1) to $$(p8), and new ($$( p7.Replace('1', '2'))) s$$(p9)\")$(p6 = $$(p2))$(p7 = $$(p5))$(p5 = $(p6))$(p5)"); - target.parse("$(p2 = \"$$(p1) to $$(p8), and new ($$(p7.Replace('1', '2'))) s$$(p9)\")$(p6 = $$(p2))$(p7 = $$(p5))$(p5 = $(p6))$(p5)"); - Assert.IsTrue(true); // no problems for stack & heap - } - - /// - ///A test for parse - unlooping - /// - [TestMethod()] - public void parseUnloopingTest7() - { - var target = new Parser(new StubEnv()); - Assert.AreEqual(String.Format("2 {0} 2", Parser.PROP_VALUE_DEFAULT), - target.parse("$(test = \"1 $(test) 2\")$(test = $(test.Replace('1', '2')))$(test)")); - } - - /// - ///A test for parse - unlooping - /// - [TestMethod()] - public void parseUnloopingTest8() - { - var target = new Parser(new StubEnv()); - Assert.AreEqual("7", target.parse("$(test = 7)$(test = $(test))$(test)")); - } - - /// - ///A test for parse - quotes - /// - [TestMethod()] - public void quotesTest1() - { - var target = new Parser(new StubEnv()); - - Assert.AreEqual(String.Empty, target.parse("$(name = \" $([System.Math]::Pow(2, 16)) \")")); - Assert.AreEqual(" 65536 ", target.UVariable.get("name", null)); - - Assert.AreEqual(String.Empty, target.parse("$(name = ' $([System.Math]::Pow(2, 16)) ')")); - Assert.AreEqual(" $([System.Math]::Pow(2, 16)) ", target.UVariable.get("name", null)); - } - - /// - ///A test for parse - quotes - /// - [TestMethod()] - public void quotesTest2() - { - var target = new Parser(new StubEnv()); - Assert.AreEqual(" left '123' right ", target.parse("$([System.String]::Format(\" left '{0}' right \", \"123\"))")); - Assert.AreEqual(" left '123' ) right ", target.parse("$([System.String]::Format(\" left '{0}' ) right \", \"123\"))")); - - Assert.AreEqual(" left \"123\" right ", target.parse("$([System.String]::Format(' left \"{0}\" right ', '123'))")); - Assert.AreEqual(" left \"123\" ) right ", target.parse("$([System.String]::Format(' left \"{0}\" ) right ', '123'))")); - } - - /// - ///A test for parse - quotes - /// - [TestMethod()] - public void quotesTest3() - { - var target = new Parser(new StubEnv()); - - Assert.AreEqual(String.Empty, target.parse("$(tpl = \"My version - '%Ver%'\")")); - Assert.AreEqual("My version - '%Ver%'", target.UVariable.get("tpl", null)); - - Assert.AreEqual(String.Empty, target.parse("$(ver = '1.2.3')")); - Assert.AreEqual("1.2.3", target.UVariable.get("ver", null)); - - Assert.AreEqual(String.Empty, target.parse("$(rev = '2417')")); - Assert.AreEqual("2417", target.UVariable.get("rev", null)); - - Assert.AreEqual("My version - '1, 2, 3, 2417'", target.parse("$(tpl.Replace(\"%Ver%\", \"$(ver.Replace('.', ', ')), $(rev)\"))")); - Assert.AreEqual("1.2.3 version - '1.2.3.2417'", target.parse("$(tpl.Replace(\"%Ver%\", \"$(ver).$(rev)\").Replace(\"My\", \"$(ver)\"))")); - } - - /// - ///A test for parse - quotes - /// - [TestMethod()] - public void quotesTest4() - { - var target = new Parser(new StubEnv()); - - target.UVariable.set("name", "project", "test123"); - target.UVariable.evaluate("name", "project", new EvaluatorBlank(), true); - - //Assert.AreEqual("test123", target.parse("$([System.String]::Concat('$(name:project)'))")); //TODO: read note from hquotes - Assert.AreEqual("test123", target.parse("$([System.String]::Concat(\"$(name:project)\"))")); // $([System.DateTime]::Parse(\"$([System.DateTime]::UtcNow.Ticks)\").ToBinary()) - } - - /// - ///A test for parse - quotes - /// - [TestMethod()] - public void quotesTest5() - { - var target = new Parser(new StubEnv()); - - target.UVariable.set("name", null, "test123"); - target.UVariable.evaluate("name", null, new EvaluatorBlank(), true); - - Assert.AreEqual("test123", target.parse("$([System.String]::Concat(\"$(name)\"))")); - Assert.AreEqual("test123", target.parse("$([System.String]::Concat('$(name)'))")); - } - - /// - /// Evaluation from quotes - /// - [TestMethod()] - public void quotesTest6() - { - var target = new Parser(new StubEnv()); - - Assert.AreEqual(String.Empty, target.parse("$(version = \"1.2.3\")")); - Assert.AreEqual(String.Empty, target.parse("$(tpl = \"My version - $(version), \\\"$(version)\\\", '$(version)' end.\")")); - Assert.AreEqual("My version - 1.2.3, \"1.2.3\", '$(version)' end.", target.parse("$(tpl)")); - } - - /// - /// Evaluation from quotes - /// - [TestMethod()] - public void quotesTest7() - { - var uvar = new UserVariable(); - var target = new Parser(new StubEnv(), uvar); - - uvar.set("lp", null, "s1\\dir"); - uvar.evaluate("lp", null, new EvaluatorBlank(), true); - Assert.AreEqual("s1\\dir", uvar.get("lp", null)); - - Assert.AreEqual("\"s1\\dir\\p1.exe\"", target.parse("\"$(lp)\\p1.exe\"")); - Assert.AreEqual("'$(lp)\\p2.exe'", target.parse("'$(lp)\\p2.exe'")); - Assert.AreEqual("s1\\dir\\p3.exe", target.parse("$(lp)\\p3.exe")); - } - - /// - /// Evaluation from quotes - /// - [TestMethod()] - public void quotesTest8() - { - var uvar = new UserVariable(); - var target = new Parser(new StubEnv(), uvar); - - uvar.set("lp", null, "'s2\\dir'"); - uvar.evaluate("lp", null, new EvaluatorBlank(), true); - Assert.AreEqual("'s2\\dir'", uvar.get("lp", null)); - - Assert.AreEqual("\"'s2\\dir'\\p1.exe\"", target.parse("\"$(lp)\\p1.exe\"")); - //Assert.AreEqual("''s2\\dir'\\p2.exe'", target.parse("'$(lp)\\p2.exe'")); // ? TODO: unspecified for current time - Assert.AreEqual("'s2\\dir'\\p3.exe", target.parse("$(lp)\\p3.exe")); - } - - /// - /// Evaluation from quotes - /// - [TestMethod()] - public void quotesTest9() - { - var uvar = new UserVariable(); - var target = new Parser(new StubEnv(), uvar); - - uvar.set("lp", null, "\"s3\\dir\""); - uvar.evaluate("lp", null, new EvaluatorBlank(), true); - Assert.AreEqual("\"s3\\dir\"", uvar.get("lp", null)); - - //Assert.AreEqual("\"\"s3\\dir\"\\p1.exe\"", target.parse("\"$(lp)\\p1.exe\"")); // ? TODO: unspecified for current time - Assert.AreEqual("'$(lp)\\p2.exe'", target.parse("'$(lp)\\p2.exe'")); - Assert.AreEqual("\"s3\\dir\"\\p3.exe", target.parse("$(lp)\\p3.exe")); - } - - /// - /// Evaluation from quotes - /// - [TestMethod()] - public void quotesTest10() - { - var target = new Parser(new StubEnv()); - - target.UVariable.set("name", null, "test123"); - target.UVariable.evaluate("name", null, new EvaluatorBlank(), true); - - Assert.AreEqual("test123)", target.parse("$([System.String]::Concat(\"$(name))\"))")); - Assert.AreEqual("(test123", target.parse("$([System.String]::Concat(\"($(name)\"))")); - - Assert.AreEqual("(test123", target.parse("$([System.String]::Concat('($(name)'))")); - Assert.AreEqual("test123)", target.parse("$([System.String]::Concat('$(name))'))")); - - Assert.AreEqual(" left ) test123 ", target.parse("$([System.String]::Concat(\" left ) $(name) \"))")); - Assert.AreEqual(" left ) test123 ", target.parse("$([System.String]::Concat(' left ) $(name) '))")); - - Assert.AreEqual(" left () test123 ", target.parse("$([System.String]::Concat(\" left () $(name) \"))")); - Assert.AreEqual(" left () test123 ", target.parse("$([System.String]::Concat(' left () $(name) '))")); - } - - /// - ///A test for quotes - /// - [TestMethod()] - public void quotesTest11() - { - var target = new Parser(new StubEnv()); - Assert.AreEqual("simply \"text\" data", target.parse("simply \"text\" data")); - Assert.AreEqual("simply \\\"text\\\" data", target.parse("simply \\\"text\\\" data")); - Assert.AreEqual("simply \\\\\"text\\\\\" data", target.parse("simply \\\\\"text\\\\\" data")); - Assert.AreEqual("simply 'text' data", target.parse("simply 'text' data")); - Assert.AreEqual("simply \'text\' data", target.parse("simply \'text\' data")); - Assert.AreEqual("simply \\'text\\' data", target.parse("simply \\'text\\' data")); - } - - /// - /// - /// - private class MSBuildParserAccessor - { - public class Accessor: vsSBE.MSBuild.Parser - { - public Accessor(): base(new net.r_eg.vsSBE.Environment((DTE2)null)) {} - public Accessor(net.r_eg.vsSBE.Environment env): base(env) { } - } - - public class StubEvaluatingProperty: Accessor - { - public override string evaluate(string unevaluated, string project) - { - return String.Format("[E~{0}~{1}]", unevaluated, project); - } - - public override string getProperty(string name, string project) - { - if(uvariable.isExist(name, project)) { - return getUVariableValue(name, project); - } - return String.Format("[P~{0}~{1}]", name, project); - } - } - - public class ToUserVariables: StubEvaluatingProperty - { - public new IUserVariable uvariable - { - get { return base.uvariable; } - set { base.uvariable = value; } - } - } - - public class ToParse: ToUserVariables - { - - } - - public class ToPrepareVariables: StubEvaluatingProperty - { - public new PreparedData prepare(string raw) - { - return base.prepare(raw); - } - } - - public class ToEvaluateVariable: ToUserVariables - { - public new string evaluate(PreparedData prepared) - { - return base.evaluate(prepared); - } - } + var target = new EvMSBuilder(new Environment(mockDte2.Object)); + Assert.IsNotNull(target.GetPropValue(PropertyNames.CONFIG)); + Assert.IsNotNull(target.GetPropValue(PropertyNames.PLATFORM)); } } } \ No newline at end of file diff --git a/vsSolutionBuildEventTest/Properties/AssemblyInfo.cs b/vsSolutionBuildEventTest/Properties/AssemblyInfo.cs index ea3944d3..e962ab28 100644 --- a/vsSolutionBuildEventTest/Properties/AssemblyInfo.cs +++ b/vsSolutionBuildEventTest/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/BoxComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/BoxComponentTest.cs deleted file mode 100644 index 91b71b7b..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/BoxComponentTest.cs +++ /dev/null @@ -1,333 +0,0 @@ -using System; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - [TestClass] - public class BoxComponentTest - { - [TestMethod] - [ExpectedException(typeof(SubtypeNotFoundException))] - public void parseTest1() - { - var target = new Script(new StubEnv(), new UserVariable()); - target.parse(@"#[Box notrealnode]"); - } - - [TestMethod] - public void repeatTest1() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual("ab!ab!ab!ab!", noSpaces(@" - #[$(i = 0)]#[Box repeat($(i) < 4): $(i = $([MSBuild]::Add($(i), 1))) - ab! - ]", target)); - - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("4", uvar.get("i", null)); - } - - [TestMethod] - public void repeatTest2() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual("ab!ab!ab!", noSpaces(@" - #[$(i = 2)]#[Box repeat($(i) < 8): $(i = $([MSBuild]::Add($(i), 2))) - ab! - #[Box operators.sleep(50)] - ]", target)); - - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("8", uvar.get("i", null)); - } - - [TestMethod] - public void repeatTest3() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual(String.Empty, noSpaces(@" - #[$(i = 2)]#[Box repeat($(i) < 8; true): $(i = $([MSBuild]::Add($(i), 1))) - ab! - ]", target)); - - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("8", uvar.get("i", null)); - } - - [TestMethod] - public void repeatTest4() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual("ab!ab!ab!ab!", noSpaces(@" - #[$(i = 0)]#[Box repeat($(i) < 4; false): $(i = $([MSBuild]::Add($(i), 1))) - ab! - ]", target)); - - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("4", uvar.get("i", null)); - } - - [TestMethod] - [ExpectedException(typeof(InvalidArgumentException))] - public void repeatTest5() - { - var target = new Script(new StubEnv(), new UserVariable()); - noSpaces(@"#[Box repeat(false; false; true): ]", target); - } - - [TestMethod] - [ExpectedException(typeof(InvalidArgumentException))] - public void repeatTest6() - { - var target = new Script(new StubEnv(), new UserVariable()); - noSpaces(@"#[Box repeat( ): ]", target); - } - - [TestMethod] - [ExpectedException(typeof(InvalidArgumentException))] - public void repeatTest7() - { - var target = new Script(new StubEnv(), new UserVariable()); - noSpaces(@"#[Box repeat(false; 123): ]", target); // int type instead of bool - } - - [TestMethod] - [ExpectedException(typeof(IncorrectNodeException))] - public void repeatTest8() - { - var target = new Script(new StubEnv(), new UserVariable()); - noSpaces(@"#[Box repeat: ]", target); - } - - [TestMethod] - [ExpectedException(typeof(IncorrectNodeException))] - public void iterateTest1() - { - var target = new Script(new StubEnv(), new UserVariable()); - noSpaces(@"#[Box iterate: ]", target); - } - - [TestMethod] - public void iterateTest2() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual("ab!ab!ab!ab!", noSpaces(@" - #[$(i = 0)]#[Box iterate(;$(i) < 4; ): $(i = $([MSBuild]::Add($(i), 1))) - ab! - ]", target)); - - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("4", uvar.get("i", null)); - } - - [TestMethod] - public void iterateTest3() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual("ab!ab!ab!", noSpaces(@" - #[$(i = -2)]#[Box iterate(;$(i) < 4; i = $([MSBuild]::Add($(i), 2))): - ab! - ]", target)); - - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("4", uvar.get("i", null)); - } - - [TestMethod] - public void iterateTest4() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual("ab!ab!ab!", noSpaces(@" - #[Box iterate(i = 1; $(i) < 4; i = $([MSBuild]::Add($(i), 1))): - ab! - ]", target)); - - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("4", uvar.get("i", null)); - } - - [TestMethod] - [ExpectedException(typeof(InvalidArgumentException))] - public void iterateTest5() - { - var target = new Script(new StubEnv(), new UserVariable()); - target.parse(@"#[Box iterate(i = 1; $(i) < 4; i = $([MSBuild]::Add($(i), 1)); ): ]"); - } - - [TestMethod] - [ExpectedException(typeof(InvalidArgumentException))] - public void iterateTest6() - { - var target = new Script(new StubEnv(), new UserVariable()); - target.parse(@"#[Box iterate(; i = 1; $(i) < 4; i = $([MSBuild]::Add($(i), 1)) ): ]"); - } - - [TestMethod] - [ExpectedException(typeof(InvalidArgumentException))] - public void opSleepTest1() - { - var target = new Script(new StubEnv(), new UserVariable()); - target.parse(@"#[Box operators.sleep()]"); - } - - [TestMethod] - [ExpectedException(typeof(IncorrectNodeException))] - public void opSleepTest2() - { - var target = new Script(new StubEnv(), new UserVariable()); - target.parse(@"#[Box operators.notrealProperty]"); - } - - [TestMethod] - public void opSleepTest3() - { - var target = new Script(new StubEnv(), new UserVariable()); - - var start = DateTime.Now; - target.parse(@"#[Box operators.sleep(1000)]"); - var end = DateTime.Now; - - Assert.IsTrue((end - start).TotalMilliseconds >= 1000); - } - - [TestMethod] - public void stDataTest1() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - uvar.set("p1", null, "v1"); - uvar.evaluate("p1", null, new EvaluatorBlank(), true); - - Assert.AreEqual(String.Empty, target.parse("#[Box data.pack(\"test1\", false): $(p1)#[Box operators.sleep(10)] ]")); - Assert.AreEqual(String.Empty, target.parse("#[Box data.pack(\"test2\", true): $(p1) #[Box operators.sleep(10)] ]")); - - Assert.AreEqual("$(p1)#[Box operators.sleep(10)]", target.parse("#[Box data.get(\"test1\", false)]").Trim()); - Assert.AreEqual("v1", noSpaces("#[Box data.get(\"test1\", true)]", target)); - - Assert.AreEqual("v1", noSpaces("#[Box data.get(\"test2\", false)]", target)); - Assert.AreEqual("v1", noSpaces("#[Box data.get(\"test2\", true)]", target)); - } - - [TestMethod] - [ExpectedException(typeof(LimitException))] - public void stDataTest2() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - target.parse("#[Box data.pack(\"test1\", false): 123]"); - target.parse("#[Box data.pack(\"test1\", true): 123]"); - } - - [TestMethod] - [ExpectedException(typeof(NotFoundException))] - public void stDataTest3() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - target.parse("#[Box data.get(\"notexists\", false)]"); - } - - [TestMethod] - [ExpectedException(typeof(NotSupportedOperationException))] - public void stDataTest4() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - target.parse("#[Box data.get(\"test1\", false): 123]"); - } - - [TestMethod] - public void stDataTest5() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - uvar.set("p1", null, "ab!"); - uvar.evaluate("p1", null, new EvaluatorBlank(), true); - - Assert.AreEqual(String.Empty, target.parse("#[Box data.pack(\"test1\", false): $(p1) ]")); - Assert.AreEqual(String.Empty, target.parse("#[Box data.pack(\"test2\", true): $(p1) ]")); - - Assert.AreEqual("$(p1)$(p1)$(p1)$(p1)", noSpaces("#[Box data.clone(\"test1\", 4)]", target)); - Assert.AreEqual("$(p1)$(p1)$(p1)$(p1)", noSpaces("#[Box data.clone(\"test1\", 4, false)]", target)); - Assert.AreEqual("ab!ab!ab!ab!", noSpaces("#[Box data.clone(\"test1\", 4, true)]", target)); - - Assert.AreEqual("ab!ab!", noSpaces("#[Box data.clone(\"test2\", 2)]", target)); - Assert.AreEqual("ab!ab!", noSpaces("#[Box data.clone(\"test2\", 2, false)]", target)); - Assert.AreEqual("ab!ab!", noSpaces("#[Box data.clone(\"test2\", 2, true)]", target)); - - Assert.AreEqual(String.Empty, noSpaces("#[Box data.clone(\"test2\", 0)]", target)); - } - - [TestMethod] - [ExpectedException(typeof(NotFoundException))] - public void stDataTest6() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - target.parse("#[Box data.clone(\"notexists\", 4)]"); - } - - [TestMethod] - [ExpectedException(typeof(NotFoundException))] - public void stDataTest7() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual(String.Empty, target.parse("#[Box data.pack(\"test1\", false): 123 ]")); - Assert.AreEqual(String.Empty, target.parse("#[Box data.free(\"test1\")]")); - - target.parse("#[Box data.get(\"test1\", false)]"); - } - - [TestMethod] - [ExpectedException(typeof(NotSupportedOperationException))] - public void stDataTest8() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - target.parse("#[Box data.free(\"test1\"): 123]"); - } - - [TestMethod] - public void stDataTest9() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual(String.Empty, target.parse("#[Box data.free(\"test1\")]")); - Assert.AreEqual(String.Empty, target.parse("#[Box data.free(\"test2\")]")); - } - - private string noSpaces(string raw, ISBEScript script) - { - return script.parse(raw).Replace("\r", "").Replace("\n", "").Replace(" ", ""); - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/BuildComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/BuildComponentTest.cs deleted file mode 100644 index 49aac612..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/BuildComponentTest.cs +++ /dev/null @@ -1,564 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using EnvDTE; -using EnvDTE80; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using net.r_eg.vsSBE.Actions; -using net.r_eg.vsSBE.Bridge; -using net.r_eg.vsSBE.Events; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Components.Build; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - /// - ///This is a test class for BuildComponentTest and is intended - ///to contain all BuildComponentTest Unit Tests - /// - [TestClass()] - public class BuildComponentTest - { - private const string EXIST_GUID = "{11111111-1111-1111-1111-111111111111}"; - private const string NOTEXIST_GUID = "{00000000-0000-0000-0000-000000000000}"; - - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - /// - /// Mock of IEnvironment for current tests - /// - public IEnvironment Env - { - get - { - if(env == null) - { - var mockEnv = new Mock(); - var mockSolutionActiveConfiguration = new Mock(); - var mockSolutionContexts = new Mock(); - - mockSolutionContexts.Setup(m => m.GetEnumerator()).Returns(SolutionContexts); - mockSolutionActiveConfiguration.SetupGet(p => p.SolutionContexts).Returns(mockSolutionContexts.Object); - mockEnv.SetupGet(p => p.SolutionActiveCfg).Returns(mockSolutionActiveConfiguration.Object); - mockEnv.SetupGet(p => p.SolutionFile).Returns("stub.sln"); - mockEnv.SetupGet(p => p.IsOpenedSolution).Returns(true); - env = mockEnv.Object; - } - return env; - } - } - protected IEnvironment env; - - /// - /// SolutionContexts for tests - /// - /// - public IEnumerator SolutionContexts - { - get{ - yield return solutionContext("project1", "platform1", true, true); - yield return solutionContext("project2", "platform1", false, false); - yield return solutionContext("project3", "platform2", false, false); - } - } - - /// - /// Mock of SolutionContext - /// - /// project name - /// platform name - /// IsBuildable - /// - public SolutionContext solutionContext(string project, string platform, bool shouldBuild, bool shouldDeploy) - { - var mock = new Mock(); - mock.SetupGet(p => p.ProjectName).Returns(project); - mock.SetupGet(p => p.PlatformName).Returns(platform); - mock.SetupGet(p => p.ShouldBuild).Returns(shouldBuild); - mock.SetupGet(p => p.ShouldDeploy).Returns(shouldDeploy); - return mock.Object; - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SubtypeNotFoundException))] - public void parseTest() - { - BuildComponentAccessor target = new BuildComponentAccessor(); - target.parse("[Build UnitTestChecking = true]"); - } - - /// - ///A test for parse - stCancel - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void stCancelTest1() - { - BuildComponentAccessor target = new BuildComponentAccessor(); - target.parse("#[Build cancel = true]"); - } - - /// - ///A test for parse - stCancel - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void stCancelTest2() - { - BuildComponentAccessor target = new BuildComponentAccessor(); - target.parse("Build cancel = true"); - } - - /// - ///A test for parse -> stCancel - ///#[Build cancel = true] - /// - [TestMethod()] - public void stCancelTest3() - { - BuildComponentAccessor target = new BuildComponentAccessor(); - Assert.AreEqual(Value.Empty, target.parse("[Build cancel = true]")); - Assert.AreEqual(Value.Empty, target.parse("[Build cancel = 1]")); - Assert.AreEqual(Value.Empty, target.parse("[Build cancel = false]")); - Assert.AreEqual(Value.Empty, target.parse("[Build cancel = 0]")); - Assert.AreEqual(Value.Empty, target.parse("[Build cancel = true ] ")); - } - - /// - ///A test for parse -> stCancel - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectSyntaxException))] - public void stCancelTest4() - { - BuildComponentAccessor target = new BuildComponentAccessor(); - target.parse("[Build cancel = 1true]"); - } - - /// - ///A test for parse -> stCancel - /// - [TestMethod()] - public void stCancelTest5() - { - var target = new BuildComponentAccessor(); - - try { - target.parse("[Build cancel]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Build cancel : true]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - } - - /// - ///A test for parse -> stType - /// - [TestMethod()] - public void stTypeTest1() - { - IEnvironment _env = new Environment((DTE2)(new Mock()).Object); - BuildComponent target = new BuildComponent(_env); - - Assert.AreEqual(BuildType.Common.ToString(), target.parse("[Build type]")); - - _env.BuildType = BuildType.Compile; - Assert.AreEqual(BuildType.Compile.ToString(), target.parse("[Build type]")); - - _env.BuildType = BuildType.Clean; - Assert.AreEqual(BuildType.Clean, (BuildType)Enum.Parse(typeof(BuildType), target.parse("[Build type]"))); - } - - /// - ///A test for parse -> stType - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stTypeTest2() - { - BuildComponent target = new BuildComponent(Env); - target.parse("[Build type = true]"); - } - - /// - ///A test for parse -> stProjects - ///#[Build projects.find("name")] - /// - [TestMethod()] - [ExpectedException(typeof(ArgumentPMException))] - public void stProjectsTest1() - { - BuildComponentAccessor target = new BuildComponentAccessor(); - target.parse("[Build projects.find(name)]"); - } - - /// - ///A test for parse -> stProjects - ///#[Build projects.find("name")] - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void stProjectsTest2() - { - BuildComponent target = new BuildComponent(Env); - target.parse("[Build projects.find(\"NotExist\").]"); - } - - /// - ///A test for parse -> stProjectConf - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectSyntaxException))] - public void stProjectConfTest1() - { - BuildComponent target = new BuildComponent(Env); - target.parse("[Build projects.find(\"project1\").IsBuildable = val]"); - } - - /// - ///A test for parse -> stProjectConf - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stProjectConfTest2() - { - BuildComponent target = new BuildComponent(Env); - target.parse("[Build projects.find(\"project1\").NotExist = true]"); - } - - /// - ///A test for parse -> IsBuildable - /// - [TestMethod()] - public void isBuildableTest1() - { - BuildComponent target = new BuildComponent(Env); - Assert.AreEqual(Value.Empty, target.parse("[Build projects.find(\"project1\").IsBuildable = true]")); - } - - /// - ///A test for parse -> IsBuildable - /// - [TestMethod()] - public void isBuildableTest2() - { - BuildComponent target = new BuildComponent(Env); - Assert.AreEqual("true", target.parse("[Build projects.find(\"project1\").IsBuildable]")); - Assert.AreEqual("false", target.parse("[Build projects.find(\"project2\").IsBuildable]")); - } - - /// - ///A test for parse -> IsDeployable - /// - [TestMethod()] - public void isDeployableTest1() - { - BuildComponent target = new BuildComponent(Env); - Assert.AreEqual(Value.Empty, target.parse("[Build projects.find(\"project1\").IsDeployable = true]")); - } - - /// - ///A test for parse -> IsDeployable - /// - [TestMethod()] - public void isDeployableTest2() - { - BuildComponent target = new BuildComponent(Env); - Assert.AreEqual("true", target.parse("[Build projects.find(\"project1\").IsDeployable]")); - Assert.AreEqual("false", target.parse("[Build projects.find(\"project2\").IsDeployable]")); - } - - /// - ///A test for parse -> stSolution - /// - [TestMethod()] - public void stSolutionTest1() - { - var target = new BuildComponentAccessor(Env); - - try { - target.parse("[Build solution.current]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Build solution.path(\"path.sln\")]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stSolution - /// - [TestMethod()] - [ExpectedException(typeof(InvalidArgumentException))] - public void stSolutionTest2() - { - BuildComponent target = new BuildComponentAccessor(Env); - Assert.AreEqual(Value.Empty, target.parse("[Build solution.path()]")); - } - - /// - ///A test for parse - stSolution - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stSolutionTest3() - { - BuildComponent target = new BuildComponent(Env); - Assert.AreEqual(Value.Empty, target.parse("[Build solution.NotRealProperty]")); - } - - /// - ///A test for parse - stSolution - stSlnPMap - /// - [TestMethod()] - public void stSlnPMapTest1() - { - var target = new BuildComponentAccessor(Env); - - try { - target.parse("[Build solution.current.NotExistProperty]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Build solution.current.First]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Build solution.current.Last]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Build solution.current.LastRaw]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Build solution.current.projectBy(\"" + EXIST_GUID + "\")]"); - Assert.Fail("5"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stSolution - stSlnPMap - /// - [TestMethod()] - public void stSlnPMapTest2() - { - var target = new BuildComponentAccessor(Env); - - try { - target.parse("[Build solution.path(\"stub.sln\").First]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Build solution.path(\"stub.sln\").Last]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Build solution.path(\"stub.sln\").LastRaw]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Build solution.path(\"stub.sln\").projectBy(\"" + EXIST_GUID + "\")]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stSolution - stSlnPMap - /// - [TestMethod()] - [ExpectedException(typeof(KeyNotFoundException))] - public void stSlnPMapTest3() - { - BuildComponent target = new BuildComponentAccessor(Env); - Assert.AreEqual(Value.Empty, target.parse("[Build solution.current.projectBy(\"" + NOTEXIST_GUID + "\")]")); - } - - /// - ///A test for parse - stSolution - stSlnPMap - /// - [TestMethod()] - public void stSlnPMapTest4() - { - BuildComponent target = new BuildComponentAccessor(Env); - Assert.AreEqual(EXIST_GUID, target.parse("[Build solution.current.GuidList]")); - Assert.AreEqual(EXIST_GUID, target.parse("[Build solution.path(\"stub.sln\").GuidList]")); - } - - /// - ///A test for parse - stSolution - stSlnPMap - /// - [TestMethod()] - [ExpectedException(typeof(InvalidArgumentException))] - public void stSlnPMapTest5() - { - BuildComponent target = new BuildComponentAccessor(Env); - Assert.AreEqual(Value.Empty, target.parse("[Build solution.current.projectBy()]")); - } - - /// - ///A test for parse - stSolution - stSlnPMap - projectsMap - /// - [TestMethod()] - public void projectsMapTest1() - { - BuildComponent target = new BuildComponentAccessor(Env); - - Func h = delegate(string l1, string l2) - { - Assert.AreEqual("Project1", target.parse(String.Format("[Build solution.{0}.{1}.name]", l1, l2))); - Assert.AreEqual("path\\to.sln", target.parse(String.Format("[Build solution.{0}.{1}.path]", l1, l2))); - Assert.AreEqual(EXIST_GUID, target.parse(String.Format("[Build solution.{0}.{1}.guid]", l1, l2))); - Assert.AreEqual("{22222222-2222-2222-2222-222222222222}", target.parse(String.Format("[Build solution.{0}.{1}.type]", l1, l2))); - return true; - }; - - h("current", "First"); - h("current", "Last"); - h("current", "FirstRaw"); - h("current", "LastRaw"); - h("current", "projectBy(\"" + EXIST_GUID + "\")"); - - h("path(\"path\\to.sln\")", "First"); - h("path(\"path\\to.sln\")", "Last"); - h("path(\"path\\to.sln\")", "FirstRaw"); - h("path(\"path\\to.sln\")", "LastRaw"); - h("path(\"path\\to.sln\")", "projectBy(\"" + EXIST_GUID + "\")"); - } - - /// - ///A test for parse - stSolution - stSlnPMap - projectsMap - /// - [TestMethod()] - public void projectsMapTest2() - { - var target = new BuildComponentAccessor(Env); - - try { - target.parse("[Build solution.path(\"stub.sln\").First.NotRealProperty]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Build solution.current.First.NotRealProperty]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stSolution - stSlnPMap - projectsMap - /// - [TestMethod()] - public void projectsMapTest3() - { - BuildComponent target = new BuildComponentAccessor(Env); - - Func h = delegate(string l1, string l2) { - Assert.AreEqual("Project1", target.parse(String.Format("[Build solution.{0}.{1}.name.RightProperty]", l1, l2))); - Assert.AreEqual("path\\to.sln", target.parse(String.Format("[Build solution.{0}.{1}.path.RightProperty]", l1, l2))); - Assert.AreEqual(EXIST_GUID, target.parse(String.Format("[Build solution.{0}.{1}.guid.RightProperty]", l1, l2))); - Assert.AreEqual("{22222222-2222-2222-2222-222222222222}", target.parse(String.Format("[Build solution.{0}.{1}.type.RightProperty]", l1, l2))); - return true; - }; - - try { h("current", "First"); Assert.Fail("1"); } catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - try { h("current", "Last"); Assert.Fail("2"); } catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - try { h("current", "FirstRaw"); Assert.Fail("3"); } catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - try { h("current", "LastRaw"); Assert.Fail("4"); } catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - try { h("current", "projectBy(\"" + EXIST_GUID + "\")"); Assert.Fail("5"); } catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { h("path(\"path\\to.sln\")", "First"); Assert.Fail("6"); } catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - try { h("path(\"path\\to.sln\")", "Last"); Assert.Fail("7"); } catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - try { h("path(\"path\\to.sln\")", "FirstRaw"); Assert.Fail("8"); } catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - try { h("path(\"path\\to.sln\")", "LastRaw"); Assert.Fail("9"); } catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - try { h("path(\"path\\to.sln\")", "projectBy(\"" + EXIST_GUID + "\")"); Assert.Fail("10"); } catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - } - - private class BuildComponentAccessor: BuildComponent - { - public BuildComponentAccessor() - : base((IEnvironment)null) - { - var mock = new Mock((IEnvironment)null, SolutionEventType.General); - mock.Setup(m => m.exec(It.IsAny(), It.IsAny())); - dteo = mock.Object; - } - - public BuildComponentAccessor(IEnvironment env) - : base(env) - { - - } - - protected class StubProjectsMap: ProjectsMap - { - public StubProjectsMap() - { - projects[EXIST_GUID] = new Project() - { - guid = EXIST_GUID, - name = "Project1", - path = "path\\to.sln", - type = "{22222222-2222-2222-2222-222222222222}", - }; - order.Add(EXIST_GUID); - } - } - - protected override ProjectsMap getProjectsMap(string sln) - { - return new StubProjectsMap(); - } - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/CommentComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/CommentComponentTest.cs deleted file mode 100644 index ac625fb3..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/CommentComponentTest.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - /// - ///This is a test class for CommentComponentTest and is intended - ///to contain all CommentComponentTest Unit Tests - /// - [TestClass()] - public class CommentComponentTest - { - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest() - { - CommentComponent target = new CommentComponent(); - Assert.AreEqual(Value.Empty, target.parse("[\"test\"]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest2() - { - CommentComponent target = new CommentComponent(); - Assert.AreEqual(Value.Empty, target.parse("[\"line1 \n line2\"]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest3() - { - CommentComponent target = new CommentComponent(); - target.parse("#[\"test\"]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest4() - { - CommentComponent target = new CommentComponent(); - target.parse("[test]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest5() - { - CommentComponent target = new CommentComponent(); - target.parse("test"); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest6() - { - CommentComponent target = new CommentComponent(); - target.parse(""); - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/ConditionComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/ConditionComponentTest.cs deleted file mode 100644 index 5a3c1100..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/ConditionComponentTest.cs +++ /dev/null @@ -1,492 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - /// - ///This is a test class for ConditionComponentTest and is intended - ///to contain all ConditionComponentTest Unit Tests - /// - [TestClass()] - public class ConditionComponentTest - { - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - target.parse("#[(true){body1}]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest2() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - target.parse("[(true)]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest4() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - Assert.AreEqual(Value.Empty, target.parse("[ (true * 1) { body1 } ]")); - Assert.AreEqual(" body1 ", target.parse("[ (!true * 1) { body1 } ]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest5() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - target.parse("[ (!) { body1 } ]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest6() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - Assert.AreEqual(" body1 ", target.parse("[ (true) { body1 } ]")); - Assert.AreEqual(" body1 ", target.parse("[ (true == 1) { body1 } ]")); - Assert.AreEqual(" body1 ", target.parse("[ (true == true) { body1 } ]")); - Assert.AreEqual(" body1 ", target.parse("[(true){ body1 }]")); - Assert.AreEqual("\n body1 \n", target.parse("[(true){\n body1 \n}]")); - Assert.AreEqual(" body1 ", target.parse("[ (\"true\" == 1) { body1 } ]")); - Assert.AreEqual(" body1 ", target.parse("[ (\"true\") { body1 } ]")); - Assert.AreEqual(Value.Empty, target.parse("[ (false) { body1 } ]")); - Assert.AreEqual(Value.Empty, target.parse("[ (true == 0) { body1 } ]")); - Assert.AreEqual(Value.Empty, target.parse("[ (true == false) { body1 } ]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest7() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - Assert.AreEqual(" body2 ", target.parse("[ (false) { body1 } else { body2 } ]")); - Assert.AreEqual(" body1 ", target.parse("[ (false == 0) { body1 } else { body2 } ]")); - Assert.AreEqual(" body1 ", target.parse("[ (false == false) { body1 } else { body2 } ]")); - Assert.AreEqual(" body1 ", target.parse("[ (\"false\" == 0) { body1 } else { body2 } ]")); - Assert.AreEqual(" body2 ", target.parse("[ (\"false\") { body1 } else { body2 } ]")); - Assert.AreEqual(" body2 ", target.parse("[(false){ body1 }else{ body2 }]")); - Assert.AreEqual("\n body2 \n", target.parse("[ (false) {\n body1 \n}\nelse {\n body2 \n} ]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest8() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - Assert.AreEqual(" body1 ", target.parse("[(!false){ body1 }else{ body2 }]")); - Assert.AreEqual(Value.Empty, target.parse("[(!true){ body1 }]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest9() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - - Assert.AreEqual(" body1 ", target.parse("[(str1 === str1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(\"str1 \"===\" str1\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(str1 == str1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(\"str1 \"==\" str1\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(\"str1\"==\" str1 \"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(str1==\"str1 \"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(02 == 2){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(02 === 2){ body1 }else{ body2 }]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest10() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - - Assert.AreEqual(" body2 ", target.parse("[(str1 !== str1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(\"str1 \"!==\" str1\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(str1 != str1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(\"str1 \"!=\" str1\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(02 != 2){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(02 !== 2){ body1 }else{ body2 }]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest11() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - - Assert.AreEqual(" body1 ", target.parse("[(Test123Data ~= 12){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(Test123Data ~= \" 12\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(Test 123 Data ~= \" 12\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(Test 123 Data ~= Data){ body1 }else{ body2 }]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest12() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - - Assert.AreEqual(" body2 ", target.parse("[(1 > 1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(1 >= 1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(1 > 01){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(01 >= 1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(1 < 1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(1 <= 1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(1 < 01){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(01 <= 1){ body1 }else{ body2 }]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest13() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - - Assert.AreEqual(" body2 ", target.parse("[(!str1 === str1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(!\"str1 \"===\" str1\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(! str1 == str1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(! \"str1 \"==\" str1\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(!02 == 2){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(!02 === 2){ body1 }else{ body2 }]")); - - Assert.AreEqual(" body1 ", target.parse("[(!str1 !== str1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(!\"str1 \"!==\" str1\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(! str1 != str1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(!\"str1 \"!=\" str1\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(!02 != 2){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(! 02 !== 2){ body1 }else{ body2 }]")); - - Assert.AreEqual(" body2 ", target.parse("[(!Test123Data ~= 12){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(! Test123Data ~= \" 12\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(! Test 123 Data ~= \" 12\"){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(!Test 123 Data ~= Data){ body1 }else{ body2 }]")); - - Assert.AreEqual(" body1 ", target.parse("[(!1 > 1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(!1 >= 1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(! 1 > 01){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(!01 >= 1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(! 1 < 1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(! 1 <= 1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body1 ", target.parse("[(!1 < 01){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(! 01 <= 1){ body1 }else{ body2 }]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest14() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - target.parse("[(1 > ){ body1 }else{ body2 }]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest15() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - target.parse("[(1 === ){ body1 }else{ body2 }]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest16() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - target.parse("[(1 >= ){ body1 }else{ body2 }]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void parseTest17() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - target.parse("[(2 > 1test ){ body1 }else{ body2 }]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest18() - { - var mockEnv = new Mock(); - var mockUVar = new Mock(); - ConditionComponent target = new ConditionComponent(mockEnv.Object, mockUVar.Object); - - Assert.AreEqual(" body1 ", target.parse("[(ConsoleApplication_1 ^= Console){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(ConsoleApplication_1 ^= Application){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(ConsoleApplication_1 ^= \" Console\"){ body1 }else{ body2 }]")); - - Assert.AreEqual(" body1 ", target.parse("[(ConsoleApplication_1 =^ _1){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(ConsoleApplication_1 =^ Console){ body1 }else{ body2 }]")); - Assert.AreEqual(" body2 ", target.parse("[(ConsoleApplication_1 =^ \"_1 \"){ body1 }else{ body2 }]")); - } - - /// - ///A test for parse->disclosure - /// - [TestMethod()] - public void disclosureTest1() - { - IUserVariable uv = new UserVariable(); - uv.set("test", null, "(data"); - uv.set("test2", null, "data)"); - uv.set("test3", null, "true"); - - ConditionComponent target = new ConditionComponent((new Mock()).Object, uv); - Assert.AreEqual("yes", target.parse("[( #[var test] ~= \"(data\"){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( #[var test2] ~= \"(data\"){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( (#[var test3]) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( 1 < 2 && 2 == 2 || (((2 >= 2) && true)) ){yes}else{no}]")); - } - - /// - ///A test for parse->disclosure - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void disclosureTest2() - { - ConditionComponent target = new ConditionComponent((new Mock()).Object, (new Mock()).Object); - target.parse("[( 1 < 2 && 2 == 2 || ((2 >= 2) && true)) ){yes}else{no}]"); - } - - /// - ///A test for parse->disclosure - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void disclosureTest3() - { - ConditionComponent target = new ConditionComponent((new Mock()).Object, (new Mock()).Object); - target.parse("[( 1 < 2 && () || (((2 >= 2) && true)) ){yes}else{no}]"); - } - - /// - ///A test for parse->disclosure - /// - [TestMethod()] - public void disclosureTest4() - { - IUserVariable uv = new UserVariable(); - uv.set("test", null, "data(str)"); - uv.set("test2", null, "true"); - uv.set("test3", null, "4"); - - ConditionComponent target = new ConditionComponent((new Mock()).Object, uv); - target.PostProcessingMSBuild = true; - - Assert.AreEqual("yes", target.parse("[( $(test) == \"data(str)\" ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( $(test) == \"data(str)\" && 1 < 2){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( #[var test] == \"data(str)\" && #[var test2] || #[var test3] == 4){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( #[var test] == \"data(str)\" && !#[var test2] || #[var test3] == 4){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( #[var test] == \"data(str)\" && !#[var test2] && #[var test3] == 4){yes}else{no}]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void invertTest1() - { - ConditionComponent target = new ConditionComponent((new Mock()).Object, (new Mock()).Object); - Assert.AreEqual("no", target.parse("[( (!2 == 2) && 1 < 2 ){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( (!2 == 2) && (!1 < 2) ){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( (!2 == 2) && (!1 > 2) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[(! (!2 == 2) && (!1 > 2) ){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( (!2 == 2) && (!1 < 2) || (!true) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( (!2 == 2) && (!1 < 2) || (true) ){yes}else{no}]")); - } - - /// - ///A test for parse->composite - /// - [TestMethod()] - public void compositeTest1() - { - IUserVariable uv = new UserVariable(); - uv.set("test", null, "(data"); - - ConditionComponent target = new ConditionComponent((new Mock()).Object, uv); - Assert.AreEqual("no", target.parse("[( #[var test] ~= \"(data && 1 < 2\" ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( #[var test] ~= \"(data\" && 1 < 2 ){yes}else{no}]")); - } - - /// - ///A test for parse->composite - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void compositeTest2() - { - ConditionComponent target = new ConditionComponent((new Mock()).Object, (new Mock()).Object); - target.parse("[( 2 == 2 & 1 < 2 ){yes}else{no}]"); - } - - /// - ///A test for parse->composite - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void compositeTest3() - { - ConditionComponent target = new ConditionComponent((new Mock()).Object, (new Mock()).Object); - target.parse("[( 2 == 2 | 1 < 2 ){yes}else{no}]"); - } - - /// - ///A test for parse->composite - /// - [TestMethod()] - public void compositeTest4() - { - ConditionComponent target = new ConditionComponent((new Mock()).Object, (new Mock()).Object); - Assert.AreEqual("yes", target.parse("[( 2 == 2 && 1 < 2 ){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( 2 == 2 && 1 > 2 ){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( 2 != 2 && 1 < 2 ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( 2 == 2 || 1 < 2 ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( 2 == 2 || 1 > 2 ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( 2 != 2 || 1 < 2 ){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( 2 != 2 || 1 > 2 ){yes}else{no}]")); - } - - /// - ///A test for parse->composite - /// - [TestMethod()] - public void compositeTest5() - { - ConditionComponent target = new ConditionComponent((new Mock()).Object, (new Mock()).Object); - Assert.AreEqual("no", target.parse("[( 2 == 2 && 1 < 2 && (7 == 4) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( 2 != 2 && 1 > 2 || (7 != 4) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( true && ((1 < 2) || (((2 >= 2) && true))) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( ((1 < 2) || (((2 >= 2) && true))) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( ((1 < 2) && (((2 >= 2) && true))) ){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( ((1 < 2) && (((2 > 2) && true))) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( true && ((1 < 2) || (((2 > 2) && true))) ){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( true && ((1 < 2) && (((2 > 2) && true))) ){yes}else{no}]")); - } - - /// - ///A test for parse->composite - /// - [TestMethod()] - public void compositeTest6() - { - ConditionComponent target = new ConditionComponent((new Mock()).Object, (new Mock()).Object); - Assert.AreEqual("no", target.parse("[( (1 < 2 && 2 == 2 &&(((false || 2 >= 2) && (1 && (false) && true)))) ){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( (1 < 2 && 2 == 2 &&(((false || 2 >= 2) && (1 > 7 && true)))) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( (1 < 2 && 2 == 2 ||(((2 >= 2) && true))) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( (1 < 2 && 2 == 2 || (((2 >= 2) && true))) ){yes}else{no}]")); - } - - /// - ///A test for parse->composite - /// - [TestMethod()] - public void compositeTest7() - { - IUserVariable uv = new UserVariable(); - uv.set("test", null, "data1 && data|2"); - uv.set("test2", null, "data1 || data&2"); - - ConditionComponent target = new ConditionComponent((new Mock()).Object, uv); - Assert.AreEqual("yes", target.parse("[( #[var test] == \"data1 && data|2\" ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( #[var test2] == \"data1 || data&2\" ){yes}else{no}]")); - } - - /// - ///A test for parse->composite - /// - [TestMethod()] - public void compositeTest8() - { - ConditionComponent target = new ConditionComponent((new Mock()).Object, (new Mock()).Object); - Assert.AreEqual("yes", target.parse("[( (1 < 2 && 2 == 2 && ( true || ((false || 2 >= 2) && (1 > 7 && true)))) ){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( (1 < 2 && 2 == 2 && ( true && ((false || 2 >= 2) && (1 > 7 && true)))) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( (1 < 2 && 2 == 2 || ( true && ((false || 2 >= 2) && (1 > 7 && true)))) ){yes}else{no}]")); - Assert.AreEqual("yes", target.parse("[( (1 < 2 && 2 == 2 && ( true && ((false || 2 >= 2) || (1 > 7 && true)))) ){yes}else{no}]")); - Assert.AreEqual("no", target.parse("[( (1 < 2 && 2 == 2 && ( true && ((false || 2 > 2) || (1 > 7 && true)))) ){yes}else{no}]")); - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/DTEComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/DTEComponentTest.cs deleted file mode 100644 index 6fc72cb9..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/DTEComponentTest.cs +++ /dev/null @@ -1,265 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using net.r_eg.vsSBE.Actions; -using net.r_eg.vsSBE.Events; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - /// - ///This is a test class for DTEComponentTest and is intended - ///to contain all DTEComponentTest Unit Tests - /// - [TestClass()] - public class DTEComponentTest - { - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - /// - ///A test for parse - exec - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseExecTest1() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - target.parse("#[DTE exec: command(arg)]"); - } - - /// - ///A test for parse - exec - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseExecTest2() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - target.parse("DTE exec: command(arg)"); - } - - /// - ///A test for parse - exec - /// - [TestMethod()] - [ExpectedException(typeof(InvalidArgumentException))] - public void parseExecTest3() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - target.parse("[DTE exec:]"); - } - - /// - ///A test for parse - exec - /// - [TestMethod()] - public void parseExecTest4() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - Assert.AreEqual(Value.Empty, target.parse("[DTE exec: command]")); - } - - /// - ///A test for parse - exec - /// - [TestMethod()] - public void parseExecTest5() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - Assert.AreEqual(Value.Empty, target.parse("[DTE exec: command(args)]")); - } - - /// - ///A test for parse - events.LastCommand - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void parseLastCommandTest1() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - target.emulateAfterExecute("{5EFC7975-14BC-11CF-9B2B-00AA00573819}", 264, (object)"In", (object)"Out"); - target.parse("[DTE events.LastCommand]"); - } - - /// - ///A test for parse - events.LastCommand - /// - [TestMethod()] - [ExpectedException(typeof(NotSupportedOperationException))] - public void parseLastCommandTest2() - { - DTEComponent target = new DTEComponent((IEnvironment)null); - target.parse("[DTE events.LastCommand]"); - } - - /// - ///A test for parse - events.LastCommand - /// - [TestMethod()] - public void parseLastCommandTest3() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - - string guid = "{5EFC7975-14BC-11CF-9B2B-00AA00573819}"; - int id = 264; - object customIn = (object)"In"; - object customOut = (object)"Out"; - bool pre = true; - target.emulateBeforeExecute(guid, id, customIn, customOut, false); - - Assert.AreEqual(guid, target.parse("[DTE events.LastCommand.Guid]")); - Assert.AreEqual(Value.from(id), target.parse("[DTE events.LastCommand.Id]")); - Assert.AreEqual(customIn, target.parse("[DTE events.LastCommand.CustomIn]")); - Assert.AreEqual(customOut, target.parse("[DTE events.LastCommand.CustomOut]")); - Assert.AreEqual(Value.from(pre), target.parse("[DTE events.LastCommand.Pre]")); - } - - /// - ///A test for parse - events.LastCommand - /// - [TestMethod()] - public void parseLastCommandTest4() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - - string guid = "{5EFC7975-14BC-11CF-9B2B-00AA00573819}"; - int id = 264; - object customIn = (object)"In"; - object customOut = (object)"Out"; - bool pre = false; - target.emulateAfterExecute(guid, id, customIn, customOut); - - Assert.AreEqual(guid, target.parse("[DTE events.LastCommand.Guid]")); - Assert.AreEqual(Value.from(id), target.parse("[DTE events.LastCommand.Id]")); - Assert.AreEqual(customIn, target.parse("[DTE events.LastCommand.CustomIn]")); - Assert.AreEqual(customOut, target.parse("[DTE events.LastCommand.CustomOut]")); - Assert.AreEqual(Value.from(pre), target.parse("[DTE events.LastCommand.Pre]")); - } - - /// - ///A test for parse - events.LastCommand - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void parseLastCommandTest5() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - target.emulateAfterExecute("{5EFC7975-14BC-11CF-9B2B-00AA00573819}", 264, (object)"In", (object)"Out"); - - target.parse("[DTE events.LastCommand.NotRealPropStub]"); - } - - /// - ///A test for parse - events.LastCommand - /// - [TestMethod()] - public void parseLastCommandTest6() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - - string guid = "{5EFC7975-14BC-11CF-9B2B-00AA00573819}"; - target.emulateBeforeExecute(guid, 264, (object)"", (object)"", false); - target.emulateAfterExecute(guid, 264, (object)"", (object)""); - - Assert.AreEqual(guid, target.parse("[DTE events . LastCommand . Guid]")); - } - - /// - ///A test for parse - events.LastCommand - /// - [TestMethod()] - public void parseLastCommandTest7() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - - string expectedGuid = "{5EFC7975-14BC-11CF-9B2B-00AA00573819}"; - string otherGuid = "{1496A755-94DE-11D0-8C3F-00C04FC2AAE2}"; - - target.emulateBeforeExecute(otherGuid, 1627, (object)"", (object)"", false); - target.emulateAfterExecute(expectedGuid, 264, (object)"", (object)""); - - Assert.AreEqual(expectedGuid, target.parse("[DTE events.LastCommand.Guid]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SubtypeNotFoundException))] - public void parseTest1() - { - DTEComponentAccessor target = new DTEComponentAccessor(); - target.parse("[DTE NotExist.test]"); - } - - - private class DTEComponentAccessor: DTEComponent - { - protected Mock mEnv; - protected Mock mEnvCE; - - public void emulateBeforeExecute(string guid, int id, object customIn, object customOut, bool cancelDefault) - { - mEnvCE.Raise(e => e.BeforeExecute += null, guid, id, customIn, customOut, cancelDefault); - } - - public void emulateAfterExecute(string guid, int id, object customIn, object customOut) - { - mEnvCE.Raise(e => e.AfterExecute += null, guid, id, customIn, customOut); - } - - public DTEComponentAccessor() - : base((IEnvironment)null) - { - init(); - attachCommandEvents(); - } - - protected void init() - { - this.mEnv = new Mock(); - this.env = mEnv.Object; - - initCommandEvents(); - initDTEO(); - } - - protected void initCommandEvents() - { - this.mEnvCE = new Mock(); - mEnv.Setup(p => p.Events.get_CommandEvents("{00000000-0000-0000-0000-000000000000}", 0)).Returns(mEnvCE.Object); - } - - protected void initDTEO() - { - var mDTEO = new Mock(env, SolutionEventType.General); - mDTEO.Setup(m => m.exec(It.IsAny(), It.IsAny())); - this.dteo = mDTEO.Object; - } - - //protected override void raise(string guid, int id, ref object customIn, ref object customOut) - //{ - // // ... - //} - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/FileComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/FileComponentTest.cs deleted file mode 100644 index 3bf9b280..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/FileComponentTest.cs +++ /dev/null @@ -1,899 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - /// - ///This is a test class for FileComponentTest and is intended - ///to contain all FileComponentTest Unit Tests - /// - [TestClass()] - public class FileComponentTest - { - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest() - { - FileComponent target = new FileComponent(); - target.parse("#[File get(\"file\")]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest2() - { - FileComponent target = new FileComponent(); - target.parse("File get(\"file\")"); - } - - /// - ///A test for parse - stGet - /// - [TestMethod()] - [ExpectedException(typeof(ArgumentPMException))] - public void stGetParseTest1() - { - FileComponent target = new FileComponent(); - target.parse("[File get(file)]"); - } - - /// - ///A test for parse - stGet - /// - [TestMethod()] - public void stGetParseTest2() - { - FileComponentAccessor target = new FileComponentAccessor(); - Assert.AreEqual("content from file", target.parse("[File get(\"file\")]")); - } - - /// - ///A test for parse - stGet - /// - [TestMethod()] - [ExpectedException(typeof(ScriptException))] - public void stGetParseTest3() - { - FileComponentAccessor target = new FileComponentAccessor(true); - target.parse("[File get(\"file\")]"); - } - - /// - ///A test for parse - stCall - /// - [TestMethod()] - public void stCallParseTest1() - { - var target = new FileComponent(); - - try { - target.parse("[File call(file)]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File out(file)]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stCall - /// - [TestMethod()] - public void stCallParseTest3() - { - FileComponentAccessor target = new FileComponentAccessor(); - Assert.AreEqual("stdout", target.parse("[File call(\"file\")]")); - Assert.AreEqual("stdout", target.parse("[File call(\"file\", \"args\")]")); - Assert.AreEqual("silent stdout", target.parse("[File scall(\"file\")]")); - Assert.AreEqual("silent stdout", target.parse("[File scall(\"file\", \"args\")]")); - Assert.AreEqual("silent stdout", target.parse("[File sout(\"file\")]")); - Assert.AreEqual("silent stdout", target.parse("[File sout(\"file\", \"args\")]")); - } - - /// - ///A test for parse - stCall - /// - [TestMethod()] - [ExpectedException(typeof(ArgumentPMException))] - public void stCallParseTest5() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File call(\"file\", \"args\", \"10\")]"); - } - - /// - ///A test for parse - stCall - /// - [TestMethod()] - [ExpectedException(typeof(ArgumentPMException))] - public void stCallParseTest6() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File call(\"file\", 10)]"); - } - - /// - ///A test for parse - stCall - /// - [TestMethod()] - public void stCallParseTest7() - { - FileComponentAccessor target = new FileComponentAccessor(); - Assert.AreEqual("stdout", target.parse("[File call(\"file\", \"args\", 0)]")); - Assert.AreEqual("silent stdout", target.parse("[File scall(\"file\", \"args\", 15)]")); - Assert.AreEqual("silent stdout", target.parse("[File sout(\"file\", \"args\", 10)]")); - } - - /// - ///A test for parse - stCall - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void stCallParseTest8() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File call(\"file\", \"args\", )]"); - } - - /// - ///A test for parse - stWrite - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stWriteParseTest1() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File write(\"file\")]"); - } - - /// - ///A test for parse - stWrite - /// - [TestMethod()] - public void stWriteParseTest2() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File write(\"file\"):data]"); - Assert.AreEqual("data", target.parse("[File get(\"file\")]")); - - // append, writeLine, appendLine is identical for current accessor - // however, also need checking the entry point as for the write() above: - - target.parse("[File append(\"file\"):data]"); - Assert.AreEqual("data", target.parse("[File get(\"file\")]")); - target.parse("[File writeLine(\"file\"):data]"); - Assert.AreEqual("data", target.parse("[File get(\"file\")]")); - target.parse("[File appendLine(\"file\"):data]"); - Assert.AreEqual("data", target.parse("[File get(\"file\")]")); - } - - /// - ///A test for parse - stWrite - /// - [TestMethod()] - public void stWriteParseTest3() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File write(\"file\"): multi\nline\" \n 'data'.]"); - Assert.AreEqual(" multi\nline\" \n 'data'.", target.parse("[File get(\"file\")]")); - } - - /// - ///A test for parse - stWrite - /// - [TestMethod()] - public void stWriteParseTest5() - { - var target = new FileComponent(); - - try { - target.parse("[File write(\"file\", true):data]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File write(\"file\", true, true):data]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File write(\"file\", \"true\", \"true\", \"utf-8\"):data]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File append(\"file\", true, true, \"utf-8\"):data]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File appendLine(\"file\", true, true, \"utf-8\"):data]"); - Assert.Fail("5"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File writeLine(\"file\", true, true, \"utf-8\"):data]"); - Assert.Fail("6"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stReplace - /// - [TestMethod()] - [ExpectedException(typeof(ArgumentPMException))] - public void stReplaceParseTest1() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File replace(file, pattern, replacement)]"); - } - - /// - ///A test for parse - stReplace - /// - [TestMethod()] - public void stReplaceParseTest2() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File replace(\"file\", \"from\", \"to\")]"); - Assert.AreEqual("content to file", target.parse("[File get(\"file\")]")); - } - - /// - ///A test for parse - stReplace - /// - [TestMethod()] - public void stReplaceParseTest3() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File replace.Regexp(\"file\", \"t\\s*from\", \"t to\")]"); - Assert.AreEqual("content to file", target.parse("[File get(\"file\")]")); - } - - /// - ///A test for parse - stReplace - /// - [TestMethod()] - public void stReplaceParseTest4() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File replace.Wildcards(\"file\", \"con*from \", \"\")]"); - Assert.AreEqual("file", target.parse("[File get(\"file\")]")); - } - - /// - ///A test for parse - stReplace - /// - [TestMethod()] - public void stReplaceParseTest5() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File replace.Regex(\"file\", \"t\\s*from\", \"t to\")]"); - Assert.AreEqual("content to file", target.parse("[File get(\"file\")]")); - } - - /// - ///A test for parse - stExists - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stExistsParseTest1() - { - FileComponentAccessor target = new FileComponentAccessor(); - target.parse("[File exists.stub(\"path\")]"); - } - - /// - ///A test for parse - stExists - /// - [TestMethod()] - public void stExistsParseTest2() - { - FileComponentAccessor target = new FileComponentAccessor(); - string realDir = Path.GetDirectoryName(Assembly.GetAssembly(GetType()).Location); - - Assert.AreEqual(Value.VFALSE, target.parse("[File exists.directory(\"c:\\stubdir\\notexist\")]")); - Assert.AreEqual(Value.VTRUE, target.parse("[File exists.directory(\"" + realDir + "\")]")); - } - - /// - ///A test for parse - stExists - /// - [TestMethod()] - public void stExistsParseTest3() - { - FileComponentAccessor target = new FileComponentAccessor(); - - Assert.AreEqual(Value.VFALSE, target.parse("[File exists.directory(\"System32\", false)]")); - //Assert.AreEqual(Value.VFALSE, target.parse("[File exists.directory(\"" + realDir + "\", true)]")); - Assert.AreEqual(Value.VTRUE, target.parse("[File exists.directory(\"System32\", true)]")); - } - - /// - ///A test for parse - stExists - /// - [TestMethod()] - public void stExistsParseTest4() - { - FileComponentAccessor target = new FileComponentAccessor(); - string realFile = Assembly.GetAssembly(GetType()).Location; - - Assert.AreEqual(Value.VFALSE, target.parse("[File exists.file(\"file\")]")); - Assert.AreEqual(Value.VTRUE, target.parse("[File exists.file(\"" + realFile + "\")]")); - } - - /// - ///A test for parse - stExists - /// - [TestMethod()] - public void stExistsParseTest5() - { - FileComponentAccessor target = new FileComponentAccessor(); - string realFile = Path.GetFileName(Assembly.GetAssembly(GetType()).Location); - - Assert.AreEqual(Value.VFALSE, target.parse("[File exists.file(\"cmd.exe\", false)]")); - //Assert.AreEqual(Value.VFALSE, target.parse("[File exists.file(\"" + realFile + "\", true)]")); - Assert.AreEqual(Value.VTRUE, target.parse("[File exists.file(\"cmd.exe\", true)]")); - } - - /// - ///A test for parse - stRemote - /// - [TestMethod()] - public void stRemoteTest1() - { - var target = new FileComponent(); - - try { - target.parse("[File remote]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[File remote.download]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[File remote.notRealNode]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[File remote.download(\"addr\", \"file\").notRealNode]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stRemote - /// - [TestMethod()] - public void stRemoteTest2() - { - var target = new FileComponent(); - - try { - target.parse("[File remote.download()]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File remote.download(\"addr\")]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File remote.download(\"addr\", \"file\", \"user\")]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stRemote - /// - [TestMethod()] - public void stRemoteTest3() - { - var target = new FileComponentDownloadAccessor(); - - Assert.AreEqual(Value.Empty, target.parse("[File remote.download(\"ftp://192.168.17.04:2021/dir1/non-api.png\", \"non-api.png\", \"user1\", \"mypass123\")]")); - Assert.AreEqual(target.addr, "ftp://192.168.17.04:2021/dir1/non-api.png"); - Assert.AreEqual(target.output, "non-api.png"); - Assert.AreEqual(target.user, "user1"); - Assert.AreEqual(target.pwd, "mypass123"); - } - - /// - ///A test for parse - stCopy - /// - [TestMethod()] - public void stCopyTest1() - { - var target = new FileComponent(); - - try { - target.parse("[File copy]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[File copy.file]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[File copy.directory]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[File copy.notRalNode]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stCopy - file - /// - [TestMethod()] - public void stCopyFileTest1() - { - var target = new FileComponent(); - - try { - target.parse("[File copy.file()]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File copy.file(false)]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File copy.file(\" \", \"dest\", false)]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[File copy.file(\"src\", \" \", false)]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stCopy - file - /// - [TestMethod()] - public void stCopyFileTest2() - { - var target = new FileComponentCopyFileAccessor(); - - try { - target.parse("[File copy.file(\"src\", \"dest\", false, {\"src\"})]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - - target.parse("[File copy.file(\"src\", \"dest\", false, {\"notexists\"})]"); - try { - target.parse("[File copy.file(\"src\", \"dest\", false, {\"notexists\", false})]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - - Assert.AreEqual(Value.Empty, target.parse("[File copy.file(\"path\\subdir1\\file1.txt\", \"path2\\file2.txt\", true)]")); - try { - Assert.AreEqual(Value.Empty, target.parse("[File copy.file(\"path\\subdir1\\file1.txt\", \"path2\\file2.txt\", true, {\"file1.txt\"})]")); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stCopy - copy.file(string src, string dest, bool overwrite, object except) - /// - [TestMethod()] - public void stCopyFileTest3() - { - var target = new FileComponentCopyFileAccessor(); - - Assert.AreEqual(Value.Empty, target.parse("[File copy.file(\"path\\subdir1\\file1.txt\", \"path2\\file2.txt\", true, {\"file2.txt\"})]")); - Assert.AreEqual(true, target.cmpPaths("path2", target.destDir)); - Assert.AreEqual(true, target.cmpPaths("file2.txt", target.destFile)); - Assert.AreEqual(true, target.overwrite); - Assert.AreEqual(1, target.files.Length); - Assert.AreEqual(true, target.cmpPaths("path\\subdir1\\file1.txt", target.files[0])); - } - - /// - ///A test for parse - stCopy - copy.file(string src, string dest, bool overwrite) - /// - [TestMethod()] - public void stCopyFileTest4() - { - var target = new FileComponentCopyFileAccessor(); - - Assert.AreEqual(Value.Empty, target.parse("[File copy.file(\"path\\subdir1\\file1.txt\", \"path2\\file2.txt\", true)]")); - Assert.AreEqual(true, target.cmpPaths("path2", target.destDir)); - Assert.AreEqual(true, target.cmpPaths("file2.txt", target.destFile)); - Assert.AreEqual(true, target.overwrite); - Assert.AreEqual(1, target.files.Length); - Assert.AreEqual(true, target.cmpPaths("path\\subdir1\\file1.txt", target.files[0])); - } - - /// - ///A test for parse - stCopy - directory - /// - [TestMethod()] - public void stCopyDirectoryTest1() - { - var target = new FileComponent(); - - try { - target.parse("[File copy.directory()]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File copy.directory(false)]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File copy.directory(\" \", \"dest\", false)]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[File copy.directory(\"src\", \" \", false)]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stCopy - copy.directory(string src, string dest, bool force [, bool overwrite]) - /// - [TestMethod()] - public void stCopyDirectoryTest2() - { - var target = new FileComponentCopyDirectoryAccessor(); - - using(var tf = new TempFile(true)) { - Assert.AreEqual(Value.Empty, target.parse("[File copy.directory(\"" + tf.dir + "\", \"path2\\sub1\", true, true)]")); - Assert.AreEqual(true, target.cmpPaths("path2\\sub1", target.dest)); - Assert.AreEqual(true, target.force); - Assert.AreEqual(true, target.overwrite); - Assert.AreEqual(1, target.files.Count()); - Assert.AreEqual(true, target.cmpPaths(tf.file, target.files.ElementAt(0)[0])); - - Assert.AreEqual(Value.Empty, target.parse("[File copy.directory(\"" + tf.dir + "\", \"path2\\sub1\", true)]")); - Assert.AreEqual(true, target.force); - Assert.AreEqual(false, target.overwrite); - } - } - - /// - ///A test for parse - stCopy - copy.directory - mkdir - /// - [TestMethod()] - public void stCopyDirectoryTest3() - { - var target = new FileComponentCopyDirectoryAccessor(); - - try { - target.parse("[File copy.directory(\"\", \"path2\\sub1\", false, true)]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - Assert.AreEqual(Value.Empty, target.parse("[File copy.directory(\"\", \"path2\\sub1\", true)]")); - Assert.AreEqual(true, target.cmpPaths("path2\\sub1", target.dest)); - } - - /// - ///A test for parse - stDelete - /// - [TestMethod()] - public void stDeleteTest1() - { - var target = new FileComponent(); - - try { - target.parse("[File delete]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[File delete.files]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[File delete.directory]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[File delete.notRalNode]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stDelete - Files - /// - [TestMethod()] - public void stDeleteFilesTest1() - { - var target = new FileComponent(); - - try { - target.parse("[File delete.files(\"file\")]"); - Assert.Fail("1"); - } - catch(Exception ex) { - Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException)); - } - - try { - target.parse("[File delete.files({\"file\", false})]"); - Assert.Fail("2"); - } - catch(Exception ex) { - Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException)); - } - - try { - target.parse("[File delete.files({\"file\"}, {true})]"); - Assert.Fail("3"); - } - catch(Exception ex) { - Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException)); - } - } - - /// - ///A test for parse - stDelete - Files - /// - [TestMethod()] - public void stDeleteFilesTest2() - { - var target = new FileComponentDeleteFilesAccessor(); - - Assert.AreEqual(Value.Empty, target.parse("[IO delete.files({\"file1\", \"file2\", \"file3\"})]")); - Assert.AreEqual(3, target.files.Length); - Assert.AreEqual(true, target.cmpPaths("file1", target.files[0])); - Assert.AreEqual(true, target.cmpPaths("file2", target.files[1])); - Assert.AreEqual(true, target.cmpPaths("file3", target.files[2])); - } - - /// - ///A test for parse - stDelete - Files - /// - [TestMethod()] - public void stDeleteFilesTest3() - { - var target = new FileComponentDeleteFilesAccessor(); - - Assert.AreEqual(Value.Empty, target.parse("[IO delete.files({\"file1\", \"file2\", \"file3\"}, {\"file2\", \"file1\"})]")); - Assert.AreEqual(1, target.files.Length); - Assert.AreEqual(true, target.cmpPaths("file3", target.files[0])); - } - - /// - ///A test for parse - stDelete - directory - /// - [TestMethod()] - public void stDeleteDirectoryTest1() - { - var target = new FileComponentDeleteDirectoryAccessor(); - - try { - target.parse("[File delete.directory(\"dir\")]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[File delete.directory(\" \", false)]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - private class FileComponentAccessor: FileComponent - { - public bool throwError = false; - protected string content = "content from file"; - - public FileComponentAccessor(bool throwError = false) - { - this.throwError = throwError; - } - - protected override string readToEnd(string file, Encoding enc, bool detectEncoding) - { - if(throwError) { - throw new System.IO.FileNotFoundException(String.Format("Some error for '{0}'", file)); - } - return content; - } - - protected override Encoding detectEncodingFromFile(string file) - { - return Encoding.UTF8; - } - - protected override void writeToFile(string file, string data, bool append, bool writeLine, Encoding enc) - { - if(throwError) { - throw new System.IO.IOException(String.Format("Some error for '{0}'", file)); - } - content = data; - } - - protected override string findFile(string file) - { - return file; - } - - protected override string run(string file, string args, bool silent, bool stdOut, int timeout = 0) - { - if(throwError) { - throw new ComponentException(String.Format("Some error for '{0} {1}'", file, args)); - } - return String.Format("{0}stdout", silent? "silent ": String.Empty); - } - } - - private class FileComponentDownloadAccessor: FileComponent - { - public string addr, output, user, pwd; - - protected override string download(string addr, string output, string user = null, string pwd = null) - { - this.addr = addr; - this.output = output; - this.user = user; - this.pwd = pwd; - //return base.download(addr, output, user, pwd); - return Value.Empty; - } - } - - private class FileComponentPath: FileComponent - { - public bool cmpPaths(string p1, string p2) - { - return p1.TrimStart(Path.DirectorySeparatorChar) == p2.TrimStart(Path.DirectorySeparatorChar); - } - } - - private class FileComponentCopyFileAccessor: FileComponentPath - { - public string destDir, destFile; - public bool overwrite; - public string[] files; - - protected override void copyFile(string destDir, string destFile, bool overwrite, params string[] files) - { - this.destDir = destDir.TrimStart(Path.PathSeparator); - this.destFile = destFile.TrimStart(Path.PathSeparator); - this.overwrite = overwrite; - this.files = files; - //base.copyFile(destDir, destFile, overwrite, files); - } - } - - private class FileComponentCopyDirectoryAccessor: FileComponentPath - { - public IEnumerable files; - public string dest; - public bool force, overwrite; - - protected override void copyDirectory(IEnumerable files, string dest, bool force, bool overwrite) - { - this.files = files; - this.dest = dest; - this.force = force; - this.overwrite = overwrite; - //base.copyDirectory(files, dest, force, overwrite); - } - - protected override void mkdir(string path) - { - this.dest = path; - //base.mkdir(path); - } - } - - private class FileComponentDeleteFilesAccessor: FileComponentPath - { - public string[] files; - - protected override void deleteFiles(string[] files) - { - this.files = files; - //base.deleteFiles(files); - } - } - - private class FileComponentDeleteDirectoryAccessor: FileComponentPath - { - protected override void deleteDirectory(string src, bool force) - { - //base.deleteDirectory(src, force); - } - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/FunctionComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/FunctionComponentTest.cs deleted file mode 100644 index bd6f8f8a..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/FunctionComponentTest.cs +++ /dev/null @@ -1,194 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - /// - ///This is a test class for FunctionComponentTest and is intended - ///to contain all FunctionComponentTest Unit Tests - /// - [TestClass()] - public class FunctionComponentTest - { - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get { - return testContextInstance; - } - set { - testContextInstance = value; - } - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SubtypeNotFoundException))] - public void parseTest1() - { - FunctionComponent target = new FunctionComponent(); - target.parse("[Func NotRealSubtype.check]"); - } - - /// - ///A test for parse - hash - /// - [TestMethod()] - public void hashTest1() - { - var target = new FunctionComponent(); - - try { - target.parse("[Func hash]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Func hash = 1]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - hash - /// - [TestMethod()] - public void hashTest2() - { - var target = new FunctionComponent(); - - try { - target.parse("[Func hash.MD5]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Func hash.SHA1]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - hash - /// - [TestMethod()] - public void hashTest3() - { - FunctionComponent target = new FunctionComponent(); - Assert.AreEqual("ED076287532E86365E841E92BFC50D8C", target.parse("[Func hash.MD5(\"Hello World!\")]")); - Assert.AreEqual("2EF7BDE608CE5404E97D5F042F95F89F1C232871", target.parse("[Func hash.SHA1(\"Hello World!\")]")); - } - - /// - ///A test for parse - hash - /// - [TestMethod()] - public void hashTest4() - { - var target = new FunctionComponent(); - - try { - target.parse("[Func hash.MD5(\"Hello World!\").right]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - target.parse("[Func hash.SHA1(\"Hello World!\").right]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - hash - /// - [TestMethod()] - public void hashTest5() - { - var target = new FunctionComponent(); - - try { - target.parse("[Func hash.MD5(\"Hello World!\") = true]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - target.parse("[Func hash.SHA1(\"Hello World!\") = true]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - hash - /// - [TestMethod()] - public void hashTest6() - { - var target = new FunctionComponent(); - - try { - target.parse("[Func hash.MD5()]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[Func hash.SHA1()]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[Func hash.MD5(test)]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[Func hash.SHA1(test)]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[Func hash.MD5(\"test\", true)]"); - Assert.Fail("5"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[Func hash.SHA1(\"test\", true)]"); - Assert.Fail("6"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - hash - /// - [TestMethod()] - public void hashTest7() - { - FunctionComponent target = new FunctionComponent(); - Assert.AreEqual("D41D8CD98F00B204E9800998ECF8427E", target.parse("[Func hash.MD5(\"\")]")); - Assert.AreEqual("DA39A3EE5E6B4B0D3255BFEF95601890AFD80709", target.parse("[Func hash.SHA1(\"\")]")); - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/InternalComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/InternalComponentTest.cs deleted file mode 100644 index e17c7493..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/InternalComponentTest.cs +++ /dev/null @@ -1,329 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.Events; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - [TestClass] - public class InternalComponentTest - { - private IBootloader bootloader; - private IEnvironment env = new StubEnv(); - private IUserVariable uvariable = new UserVariable(); - - private IBootloader Loader - { - get { - if(bootloader == null) { - bootloader = new Bootloader(env, uvariable); - bootloader.register(); - } - return bootloader; - } - } - - [TestMethod] - public void eventsItemRunTest1() - { - var target = new InternalComponentAccessor(); - - try { - target.parse("[Core events.Pre.item(1).run]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[Core events.Pre.item(1).run() = true]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - target.parse("[Core events.Pre.item(1).run(): true]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - target.parse("[Core events.Pre.item(1).run().m]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - } - - [TestMethod] - public void eventsItemRunTest2() - { - var target = new InternalComponentAccessor(); - Assert.AreEqual(Value.from(true), target.parse("[Core events.Pre.item(1).run()]")); - Assert.AreEqual(Value.from(true), target.parse("[Core events.Pre.item(1).run(Common)]")); - Assert.AreEqual(Value.from(false), target.parse("[Core events.Pre.item(2).run()]")); - Assert.AreEqual(Value.from(false), target.parse("[Core events.Pre.item(3).run()]")); - Assert.AreEqual(Value.from(false), target.parse("[Core events.Pre.item(3).run(Common)]")); - Assert.AreEqual(Value.from(true), target.parse("[Core events.Pre.item(3).run(Rebuild)]")); - } - - /// - ///A test for parse - /// - [TestMethod] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest() - { - InternalComponent target = new InternalComponent(Loader); - target.parse("#[vsSBE events.Type.item(1)]"); - } - - /// - ///A test for parse - /// - [TestMethod] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest2() - { - InternalComponent target = new InternalComponent(Loader); - target.parse("vsSBE events.Type.item(1)"); - } - - /// - ///A test for parse - /// - [TestMethod] - [ExpectedException(typeof(SubtypeNotFoundException))] - public void parseTest3() - { - InternalComponent target = new InternalComponent(Loader); - target.parse("[vsSBE NoExist.Type]"); - } - - /// - ///A test for parse - stEvents - /// - [TestMethod] - [ExpectedException(typeof(OperandNotFoundException))] - public void stEventsParseTest1() - { - InternalComponent target = new InternalComponent(Loader); - target.parse("[vsSBE events.Type.item(name)]"); - } - - /// - ///A test for parse - stEvents - /// - [TestMethod()] - [ExpectedException(typeof(OperandNotFoundException))] - public void stEventsParseTest2() - { - InternalComponent target = new InternalComponent(Loader); - target.parse("[vsSBE events.Type.item(1).test]"); - } - - /// - ///A test for parse - stEventItem - pEnabled - /// - [TestMethod()] - public void pEnabledParseTest1() - { - InternalComponentAccessor target = new InternalComponentAccessor(); - Assert.AreEqual(Value.from(true), target.parse("[vsSBE events.Pre.item(1).Enabled]")); - Assert.AreEqual(Value.from(true), target.parse("[vsSBE events.Pre.item(\"Name1\").Enabled]")); - Assert.AreEqual(Value.from(false), target.parse("[vsSBE events.Pre.item(2).Enabled]")); - Assert.AreEqual(Value.from(false), target.parse("[vsSBE events.Pre.item(\"Name2\").Enabled]")); - } - - /// - ///A test for parse - stEventItem - pEnabled - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectSyntaxException))] - public void pEnabledParseTest2() - { - InternalComponentAccessor target = new InternalComponentAccessor(); - target.parse("[vsSBE events.Pre.item(1).Enabled = 1true]"); - } - - /// - ///A test for parse - stEventItem - pEnabled - /// - [TestMethod()] - public void pEnabledParseTest3() - { - InternalComponentAccessor target = new InternalComponentAccessor(); - Assert.AreEqual(Value.from(true), target.parse("[vsSBE events.Pre.item(1).Enabled]")); - Assert.AreEqual(Value.Empty, target.parse("[vsSBE events.Pre.item(1).Enabled = false]")); - Assert.AreEqual(Value.from(false), target.parse("[vsSBE events.Pre.item(1).Enabled]")); - - Assert.AreEqual(Value.from(false), target.parse("[vsSBE events.Pre.item(\"Name2\").Enabled]")); - Assert.AreEqual(Value.Empty, target.parse("[vsSBE events.Pre.item(\"Name2\").Enabled = true]")); - Assert.AreEqual(Value.from(true), target.parse("[vsSBE events.Pre.item(\"Name2\").Enabled]")); - } - - /// - ///A test for parse - stEventItem - pStatus - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void pStatusParseTest1() - { - InternalComponentAccessor target = new InternalComponentAccessor(); - target.parse("[vsSBE events.Pre.item(1).Status.Has Errors]"); - } - - /// - ///A test for parse - stEventItem - pStatus - /// - [TestMethod()] - public void pStatusParseTest2() - { - InternalComponentAccessor target = new InternalComponentAccessor(); - Assert.AreEqual("false", target.parse("[vsSBE events.Pre.item(1).Status.HasErrors]")); - } - - /// - ///A test for parse - stEventItem - pStatus - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void pStatusParseTest3() - { - InternalComponentAccessor target = new InternalComponentAccessor(); - target.parse("[vsSBE events.Pre.item(1).Status.NotExistProp]"); - } - - [TestMethod] - [ExpectedException(typeof(IncorrectNodeException))] - public void startUpProjectTest1() - { - var target = new InternalComponent(Loader); - target.parse("[Core StartUpProject: test]"); - } - - [TestMethod] - public void startUpProjectTest2() - { - IEnvironment env = new StubEnv(); - var target = new InternalComponent(env); - string defProject = env.StartupProjectString; - - Assert.AreEqual(env.StartupProjectString, target.parse("[Core StartUpProject]")); - - Assert.AreEqual(String.Empty, target.parse("[Core StartUpProject = project1]")); - Assert.AreEqual("project1", env.StartupProjectString); - Assert.AreEqual(env.StartupProjectString, target.parse("[Core StartUpProject]")); - - Assert.AreEqual(String.Empty, target.parse("[Core StartUpProject = \"project2\"]")); - Assert.AreEqual("project2", env.StartupProjectString); - Assert.AreEqual(env.StartupProjectString, target.parse("[Core StartUpProject]")); - - Assert.AreEqual(String.Empty, target.parse("[Core StartUpProject = \"\"]")); - Assert.AreEqual(defProject, env.StartupProjectString); - Assert.AreEqual(env.StartupProjectString, target.parse("[Core StartUpProject]")); - } - - [TestMethod] - public void startUpProjectTest3() - { - IEnvironment env = new StubEnv(); - var target = new InternalComponent(env); - string defProject = env.StartupProjectString; - - Assert.AreEqual(String.Empty, target.parse("[Core StartUpProject = project1]")); - Assert.AreEqual("project1", env.StartupProjectString); - Assert.AreEqual(env.StartupProjectString, target.parse("[Core StartUpProject]")); - - Assert.AreEqual(String.Empty, target.parse("[Core StartUpProject =]")); - Assert.AreEqual(defProject, env.StartupProjectString); - Assert.AreEqual(env.StartupProjectString, target.parse("[Core StartUpProject]")); - } - - /// - ///A test for parse - stEventItem - pStdout - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void pStdoutTest1() - { - var target = new InternalComponentAccessor(); - target.parse("[Core events.Pre.item(1).stdout = true]"); - } - - /// - ///A test for parse - stEventItem - pStdout - /// - [TestMethod()] - public void pStdoutTest2() - { - var target = new InternalComponentAccessor(); - Assert.AreNotEqual(null, target.parse("[Core events.Pre.item(1).stdout]")); - } - - /// - ///A test for parse - stEventItem - pStderr - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void pStderrTest1() - { - var target = new InternalComponentAccessor(); - target.parse("[Core events.Pre.item(1).stderr = true]"); - } - - /// - ///A test for parse - stEventItem - pStderr - /// - [TestMethod()] - public void pStderrTest2() - { - var target = new InternalComponentAccessor(); - Assert.AreNotEqual(null, target.parse("[Core events.Pre.item(1).stderr]")); - } - - private class InternalComponentAccessor: InternalComponent - { - private SBEEvent[] evt = null; - - public InternalComponentAccessor() - : base(new StubEnv()) - { - - } - - protected override ISolutionEvent[] getEvent(SolutionEventType type) - { - if(evt != null) { - return evt; - } - - evt = new SBEEvent[3]{ - new SBEEvent(){ - Name = "Name1", - SupportMSBuild = false, - SupportSBEScripts = false, - Mode = new ModeFile() { Command = "" }, - Enabled = true - }, - new SBEEvent(){ - Name = "Name2", - Mode = new ModeFile() { Command = "" }, - Enabled = false - }, - new SBEEvent(){ - Name = "Name3", - SupportMSBuild = false, - SupportSBEScripts = false, - BuildType = Bridge.BuildType.Rebuild, - Mode = new ModeFile() { Command = "" }, - Enabled = true - } - }; - return evt; - } - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/MSBuildComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/MSBuildComponentTest.cs deleted file mode 100644 index 08a66e33..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/MSBuildComponentTest.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - [TestClass()] - public class MSBuildComponentTest - { - private IBootloader bootloader; - private IEnvironment env = new StubEnv(); - private IUserVariable uvariable = new UserVariable(); - - private IBootloader Loader - { - get { - if(bootloader == null) { - bootloader = new Bootloader(env, uvariable); - bootloader.register(); - } - return bootloader; - } - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest1() - { - var target = new MSBuildComponent(Loader); - Assert.AreEqual(vsSBE.MSBuild.Parser.PROP_VALUE_DEFAULT, target.parse("[$(notRealVariablename)]")); - Assert.AreEqual("65536", target.parse("[$([System.Math]::Pow(2, 16))]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest2() - { - var target = new MSBuildComponent(Loader); - - try { - target.parse("[$()]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(SyntaxIncorrectException), ex.GetType().ToString()); } - - try { - target.parse("[$(]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(SyntaxIncorrectException), ex.GetType().ToString()); } - - try { - target.parse("[$(notRealVariablename]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(SyntaxIncorrectException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest3() - { - var target = new MSBuildComponent(Loader); - Assert.AreEqual(Value.Empty, target.parse("[$(vParseTest3 = \"string123\")]")); - Assert.AreEqual(" left 'string123' ) right ", target.parse("[$([System.String]::Format(\" left '{0}' ) right \", $(vParseTest3)))]")); - Assert.AreEqual(" left \"string123\" ) right ", target.parse("[$([System.String]::Format(' left \"{0}\" ) right ', $(vParseTest3)))]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest4() - { - var target = new MSBuildComponent(Loader); - Assert.AreEqual("$(name)", target.parse("[$$(name)]")); - Assert.AreEqual("$$(name)", target.parse("[$$$(name)]")); - Assert.AreEqual("$([System.String]::Format(\" left '{0}' ) right \", $(name)))", target.parse("[$$([System.String]::Format(\" left '{0}' ) right \", $(name)))]")); - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/NuGetComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/NuGetComponentTest.cs deleted file mode 100644 index c9e7dbfa..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/NuGetComponentTest.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - [TestClass()] - public class NuGetComponentTest - { - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SubtypeNotFoundException))] - public void parseTest1() - { - var target = new NuGetComponent(); - target.parse("[NuGet NotRealSubtype.check]"); - } - - /// - ///A test for parse - gnt - /// - [TestMethod()] - public void gntTest1() - { - var target = new NuGetComponent(); - - try { - target.parse("[NuGet gnt]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[NuGet gnt()]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[NuGet gnt.NotRealNode]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - gnt.raw - /// - [TestMethod()] - public void gntRawTest1() - { - var target = new NuGetComponent(); - - try { - target.parse("[NuGet gnt.raw()]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[NuGet gnt.raw(\"the is not a correct command\")]"); - Assert.Fail("2"); - } - catch(System.Exception) { - Assert.IsTrue(true); // should be any exception from gnt.core as normal behavior - } - } - } -} \ No newline at end of file diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/OWPComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/OWPComponentTest.cs deleted file mode 100644 index 0598415e..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/OWPComponentTest.cs +++ /dev/null @@ -1,388 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - /// - ///This is a test class for OWPComponentTest and is intended - ///to contain all OWPComponentTest Unit Tests - /// - [TestClass()] - public class OWPComponentTest - { - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - /// - /// Mock of IEnvironment for current tests - /// - public IEnvironment Env - { - get - { - if(env == null) - { - var owp = new Mock(); - owp.Setup(m => m.OutputString(It.IsAny())); - owp.Setup(m => m.Activate()); - owp.Setup(m => m.Clear()); - - var ow = new Mock(); - ow.Setup(m => m.getByName(It.IsAny(), It.IsAny())).Returns(owp.Object); - ow.Setup(m => m.deleteByName(It.IsAny())); - - var mockEnv = new Mock(); - mockEnv.SetupGet(p => p.OutputWindowPane).Returns(ow.Object); - - env = mockEnv.Object; - } - return env; - } - } - protected IEnvironment env; - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - target.parse("#[OWP out.Warnings.Count]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest2() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - target.parse("OWP out.Warnings.Count"); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SubtypeNotFoundException))] - public void parseTest3() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - target.parse("[OWP NotFound.Test]"); - } - - /// - ///A test for parse - stOut - /// - [TestMethod()] - public void stOutParseTest1() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - Assert.AreEqual(Value.Empty, target.parse("[OWP out.All]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP out]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP out.Warnings.Raw]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP out.Warnings]")); - Assert.AreEqual("0", target.parse("[OWP out.Warnings.Count]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP out.Warnings.Codes]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP out.Errors.Raw]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP out.Errors]")); - Assert.AreEqual("0", target.parse("[OWP out.Errors.Count]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP out.Errors.Codes]")); - } - - /// - ///A test for parse - stOut - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stOutParseTest2() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - target.parse("[OWP out.NotRealPropertyTest]"); - } - - /// - ///A test for parse - stOut - /// - [TestMethod()] - public void stOutParseTest3() - { - var target = new OWPComponent((IEnvironment)null); - - try { - target.parse("[OWP out()]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[OWP out().All]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stOut - /// - [TestMethod()] - public void stOutParseTest4() - { - var target = new OWPComponent((IEnvironment)null); - - try { - target.parse("[OWP out.All.NotRealProperty]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - target.parse("[OWP out.Warnings.NotRealProperty]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - target.parse("[OWP out.Warnings.Codes.NotRealProperty]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - target.parse("[OWP out.NotRealProperty]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[OWP out.Warnings.Count = 12]"); - Assert.Fail("5"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - stOut - /// - [TestMethod()] - public void stOutParseTest5() - { - var target = new OWPComponent((IEnvironment)null); - - try { - target.parse("[OWP out(\"NotAvailableName\").Warnings.Raw]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotFoundException), ex.GetType().ToString()); } - - try { - target.parse("[OWP out(\"814F1F57-BF57-4944-8100-CA5514BB4194\", true).All]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotFoundException), ex.GetType().ToString()); } - } - - ///A test for parse - stLog - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stLogParseTest1() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - target.parse("[OWP log]"); - } - - /// - ///A test for parse - stLog - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stLogParseTest2() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - target.parse("[OWP log.NotSupportedTest]"); - } - - /// - ///A test for parse - stLog - /// - [TestMethod()] - public void stLogParseTest3() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - Assert.AreEqual(Value.Empty, target.parse("[OWP log.Message]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP log.Level]")); - } - - /// - ///A test for parse - stItem - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stItemParseTest1() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - target.parse("[OWP item(\"name\")]"); - } - - /// - ///A test for parse - stItem - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stItemParseTest2() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - target.parse("[OWP item(\"name\").NotSupportedTest]"); - } - - /// - ///A test for parse - stItem - /// - [TestMethod()] - [ExpectedException(typeof(NotSupportedOperationException))] - public void stItemParseTest3() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - target.parse("[OWP item(\"\").write(false): ]"); - } - - /// - ///A test for parse - stItem - /// - [TestMethod()] - [ExpectedException(typeof(ArgumentPMException))] - public void stItemParseTest4() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - target.parse("[OWP item(name).write(false): ]"); - } - - /// - ///A test for parse stItemWrite - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stItemWriteParseTest1() - { - OWPComponent target = new OWPComponent((IEnvironment)null); - target.parse("[OWP item(\"name\").write(\"false\"): ]"); - } - - /// - ///A test for parse - stItemWrite - /// - [TestMethod()] - public void stItemWriteParseTest2() - { - OWPComponent target = new OWPComponent(Env); - Assert.AreEqual(Value.Empty, target.parse("[OWP item(\"name\").write(false): data]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP item(\"name\").write(true): data]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP item(\"name\").writeLine(false): data]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP item(\"name\").writeLine(true): data]")); - } - - /// - /// A test for parse - stItemWrite - /// multi-line data - /// - [TestMethod()] - public void stItemWriteParseTest3() - { - OWPComponent target = new OWPComponent(Env); - Assert.AreEqual(Value.Empty, target.parse("[OWP item(\"name\").write(false): multi\nline\" \n 'data'.]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP item(\"name\").write(true): multi\nline\" \n 'data'.]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP item(\"name\").writeLine(false): multi\nline\" \n 'data'.]")); - Assert.AreEqual(Value.Empty, target.parse("[OWP item(\"name\").writeLine(true): multi\nline\" \n 'data'.]")); - } - - /// - ///A test for parse - stItemDelete - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stItemDeleteParseTest1() - { - OWPComponent target = new OWPComponent(Env); - Assert.AreEqual(Value.Empty, target.parse("[OWP item(\"name\").delete]")); - } - - /// - ///A test for parse - stItemDelete - /// - [TestMethod()] - public void stItemDeleteParseTest2() - { - OWPComponent target = new OWPComponent(Env); - Assert.AreEqual(Value.from(false), target.parse("[OWP item(\"name\").delete = false]")); - Assert.AreEqual(Value.from(true), target.parse("[OWP item(\"name\").delete = true]")); - } - - /// - ///A test for parse - stItemClear - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stItemClearParseTest1() - { - OWPComponent target = new OWPComponent(Env); - Assert.AreEqual(Value.Empty, target.parse("[OWP item(\"name\").clear]")); - } - - /// - ///A test for parse - stItemClear - /// - [TestMethod()] - public void stItemClearParseTest2() - { - OWPComponent target = new OWPComponent(Env); - Assert.AreEqual(Value.from(false), target.parse("[OWP item(\"name\").clear = false]")); - Assert.AreEqual(Value.from(true), target.parse("[OWP item(\"name\").clear = true]")); - } - - /// - ///A test for parse - stItemActivate - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectNodeException))] - public void stItemActivateParseTest1() - { - OWPComponent target = new OWPComponent(Env); - Assert.AreEqual(Value.Empty, target.parse("[OWP item(\"name\").activate]")); - } - - /// - ///A test for parse - stItemActivate - /// - [TestMethod()] - public void stItemActivateParseTest2() - { - OWPComponent target = new OWPComponent(Env); - Assert.AreEqual(Value.from(false), target.parse("[OWP item(\"name\").activate = false]")); - Assert.AreEqual(Value.from(true), target.parse("[OWP item(\"name\").activate = true]")); - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/SevenZipComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/SevenZipComponentTest.cs deleted file mode 100644 index b4052275..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/SevenZipComponentTest.cs +++ /dev/null @@ -1,476 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using SevenZip; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - [TestClass()] - public class SevenZipComponentTest - { - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SubtypeNotFoundException))] - public void parseTest1() - { - var target = new SevenZipComponent(); - target.parse("[7z NotRealSubtype.check]"); - } - - /// - ///A test for parse - pack - /// - [TestMethod()] - public void packTest1() - { - var target = new SevenZipComponent(); - - try { - target.parse("[7z pack]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack files]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.files()]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - pack.files - /// - [TestMethod()] - public void packFilesTest1() - { - var target = new SevenZipComponent(); - - try { - target.parse("[7z pack.files(\"files\", \"output\")]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.files({\"f1\", 12}, \"output\")]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.files({\"f1\", \"f2\"}, \"output\", SevenZip)]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.files({\"f1\"}, \"output\").right]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.files()]"); - Assert.Fail("5"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - pack.files - /// - [TestMethod()] - public void packFilesTest2() - { - var target = new SevenZipComponent(); - - try { - target.parse("[7z pack.files({}, \"output\")]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - using(var tf = new TempFile()) - { - try { - target.parse("[7z pack.files({\"" + tf.file + "\", \" \"}, \"output\")]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.files({\" \", \"" + tf.file + "\"}, \"output\")]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.files({\"" + tf.file + "\"}, \" \")]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - try { - target.parse("[7z pack.files({\"thisisreallyisnotreal.file\", \" \"}, \"output\")]"); - Assert.Fail("5"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotFoundException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.files({\" \"}, \"output\")]"); - Assert.Fail("6"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - pack.files - /// - [TestMethod()] - public void packFilesTest3() - { - var target = new SevenZipComponentInputFilesAccessor(); - - //TODO - string zip = Guid.NewGuid().ToString() + ".zip"; - using(var tf = new TempFile(false)) { - Assert.AreEqual(Value.Empty, target.parse("[7z pack.files({\"" + tf.file + "\"}, \"" + zip + "\")]")); - Assert.AreEqual(Value.Empty, target.parse("[7z pack.files({\"" + tf.file + "\"}, \"" + zip + "\", SevenZip, Lzma2, 4)]")); - } - } - - /// - ///A test for parse - pack.files /the 'except' argument - /// - [TestMethod()] - public void packFilesTest4() - { - var target = new SevenZipComponentInputFilesAccessor(); - - string zip = Guid.NewGuid().ToString() + ".zip"; - - using(var tf1 = new TempFile()) - using(var tf2 = new TempFile()) - using(var tf3 = new TempFile()) - { - Assert.AreEqual(Value.Empty, target.parse("[7z pack.files({\"" + tf1.file + "\", \"" + tf2.file + "\"}, \"" + zip + "\", {\"" + tf1.file + "\"})]")); - Assert.AreEqual(1, target.FilesInput.Length); - Assert.AreEqual(tf2.file, target.FilesInput[0]); - - Assert.AreEqual(Value.Empty, target.parse("[7z pack.files({\"" + tf1.file + "\", \"" + tf2.file + "\", \"" + tf3.file + "\"}, \"" + zip + "\", {\"" + tf2.file + "\"}, SevenZip, Lzma2, 4)]")); - Assert.AreEqual(2, target.FilesInput.Length); - Assert.AreEqual(tf1.file, target.FilesInput[0]); - Assert.AreEqual(tf3.file, target.FilesInput[1]); - } - } - - /// - ///A test for parse - pack.directory - /// - [TestMethod()] - public void packDirectoryTest1() - { - var target = new SevenZipComponent(); - - try { - target.parse("[7z pack.directory(\" \", \"name.zip\")]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.directory(\"pathtodir\", \" \")]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.directory(\"dir\")]"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.directory(\"dir\", \"output\", SevenZip)]"); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.directory(\"dir\", \"output\").right]"); - Assert.Fail("5"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - target.parse("[7z pack.directory()]"); - Assert.Fail("6"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(ArgumentPMException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - pack.files - /// - [TestMethod()] - public void packDirectoryTest2() - { - var target = new SevenZipComponentInputFilesAccessor(); - - try { - target.parse("[7z pack.directory(\"notrealdirfortest\", \"output\")]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotFoundException), ex.GetType().ToString()); } - - //TODO - string zip = Guid.NewGuid().ToString() + ".zip"; - using(var tf = new TempFile(true)) { - Assert.AreEqual(Value.Empty, target.parse("[7z pack.directory(\"" + tf.dir + "\", \"" + zip + "\")]")); - Assert.AreEqual(Value.Empty, target.parse("[7z pack.directory(\"" + tf.dir + "\", \"" + zip + "\", SevenZip, Lzma2, 4)]")); - } - } - - /// - ///A test for parse - unpack - /// - [TestMethod()] - public void unpackTest1() - { - var target = new SevenZipComponent(); - - try { - target.parse("[7z unpack]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[7z unpack()]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - unpack - /// - [TestMethod()] - public void unpackTest2() - { - var target = new SevenZipComponentExtractArchiveAccessor(); - - try { - target.parse("[7z unpack(\"f1.zip\")]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotFoundException), ex.GetType().ToString()); } - - try { - target.parse("[7z unpack(\" \")]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - using(var tf = new TempFile(false, ".zip")) { - Assert.AreEqual(Value.Empty, target.parse("[7z unpack(\""+ tf.file + "\")]")); - Assert.AreEqual(target.file, target.location(tf.file)); - Assert.AreEqual(target.output, target.getDirectoryFromFile(tf.file)); - Assert.AreEqual(false, target.delete); - Assert.AreEqual(null, target.pwd); - } - - using(var tf = new TempFile(false, ".zip")) { - Assert.AreEqual(Value.Empty, target.parse("[7z unpack(\""+ tf.file + "\", true)]")); - Assert.AreEqual(target.file, target.location(tf.file)); - Assert.AreEqual(target.output, target.getDirectoryFromFile(tf.file)); - Assert.AreEqual(true, target.delete); - Assert.AreEqual(null, target.pwd); - } - - using(var tf = new TempFile(false, ".zip")) { - Assert.AreEqual(Value.Empty, target.parse("[7z unpack(\"" + tf.file + "\", true, \"pass-123\")]")); - Assert.AreEqual(target.file, target.location(tf.file)); - Assert.AreEqual(target.output, target.getDirectoryFromFile(tf.file)); - Assert.AreEqual(true, target.delete); - Assert.AreEqual("pass-123", target.pwd); - } - } - - /// - ///A test for parse - unpack - /// - [TestMethod()] - public void unpackTest3() - { - var target = new SevenZipComponentExtractArchiveAccessor(); - - try { - using(var tf = new TempFile(false, ".zip")) { - Assert.AreEqual(Value.Empty, target.parse("[7z unpack(\"" + tf.file + "\", \" \")]")); - } - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - using(var tf = new TempFile(false, ".zip")) { - Assert.AreEqual(Value.Empty, target.parse("[7z unpack(\"" + tf.file + "\", \"output-path\")]")); - Assert.AreEqual(target.file, target.location(tf.file)); - Assert.AreEqual(target.output, target.location("output-path")); - Assert.AreEqual(false, target.delete); - Assert.AreEqual(null, target.pwd); - } - - using(var tf = new TempFile(false, ".zip")) { - Assert.AreEqual(Value.Empty, target.parse("[7z unpack(\"" + tf.file + "\", \"output-path\", \"pass-123\")]")); - Assert.AreEqual(target.file, target.location(tf.file)); - Assert.AreEqual(target.output, target.location("output-path")); - Assert.AreEqual(false, target.delete); - Assert.AreEqual("pass-123", target.pwd); - } - - using(var tf = new TempFile(false, ".zip")) { - Assert.AreEqual(Value.Empty, target.parse("[7z unpack(\"" + tf.file + "\", \"output-path\", true)]")); - Assert.AreEqual(target.file, target.location(tf.file)); - Assert.AreEqual(target.output, target.location("output-path")); - Assert.AreEqual(true, target.delete); - Assert.AreEqual(null, target.pwd); - } - - using(var tf = new TempFile(false, ".zip")) { - Assert.AreEqual(Value.Empty, target.parse("[7z unpack(\"" + tf.file + "\", \"output-path\", true, \"pass-123\")]")); - Assert.AreEqual(target.file, target.location(tf.file)); - Assert.AreEqual(target.output, target.location("output-path")); - Assert.AreEqual(true, target.delete); - Assert.AreEqual("pass-123", target.pwd); - } - } - - /// - ///A test for parse - check - /// - [TestMethod()] - public void checkTest1() - { - var target = new SevenZipComponent(); - - try { - target.parse("[7z check]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } - - try { - target.parse("[7z check()]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - /// - ///A test for parse - check - /// - [TestMethod()] - public void checkTest2() - { - var target = new SevenZipComponentCheckArchiveAccessor(); - - try { - target.parse("[7z check(\"thisisreallyisnotrealfile.zip\")]"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotFoundException), ex.GetType().ToString()); } - - try { - target.parse("[7z check(\" \")]"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - using(var tf = new TempFile(false, ".zip")) { - target.parse("[7z check(\""+ tf.file +"\")]"); - Assert.AreEqual(target.location(tf.file), target.file); - Assert.AreEqual(null, target.pwd); - } - - using(var tf = new TempFile(false, ".zip")) { - target.parse("[7z check(\"" + tf.file + "\", \"pass-123\")]"); - Assert.AreEqual(target.location(tf.file), target.file); - Assert.AreEqual("pass-123", target.pwd); - } - } - - - private class SevenZipComponentInputFilesAccessor: SevenZipComponent - { - public string ArchiveName { get; set; } - public string[] FilesInput { get; set; } - public string DirPath { get; set; } - - protected override void compressFiles(SevenZipCompressor zip, string name, params string[] input) - { - ArchiveName = name; - FilesInput = input; - //base.compressFiles(zip, name, input); - } - - protected override void compressDirectory(SevenZipCompressor zip, string path, string name) - { - ArchiveName = name; - DirPath = path; - //base.compressDirectory(zip, path, name); - } - } - - private class SevenZipComponentExtractArchiveAccessor: SevenZipComponent - { - public string file { get; set; } - public string output { get; set; } - public bool delete { get; set; } - public string pwd { get; set; } - - public new string location(string file) - { - return base.location(file); - } - - public new string getDirectoryFromFile(string output) - { - return base.getDirectoryFromFile(output); - } - - protected override void extractArchive(string file, string output, bool delete, string pwd) - { - this.file = file; - this.output = output; - this.delete = delete; - this.pwd = pwd; - //base.extractArchive(file, output, delete, pwd); - } - } - - private class SevenZipComponentCheckArchiveAccessor: SevenZipComponentExtractArchiveAccessor - { - protected override string checkArchive(string file, string pwd) - { - this.file = file; - this.pwd = pwd; - return Value.Empty; - //return base.checkArchive(file, pwd); - } - } - } -} \ No newline at end of file diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/TryComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/TryComponentTest.cs deleted file mode 100644 index 85261af5..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/TryComponentTest.cs +++ /dev/null @@ -1,189 +0,0 @@ -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - [TestClass] - public class TryComponentTest - { - [TestMethod] - public void parseTest1() - { - var uvar = new UserVariable(); - var target = new TryComponent(new StubEnv(), uvar); - - Assert.AreEqual(Value.Empty, target.parse("[try{}catch{ if error }]")); - Assert.AreEqual(Value.Empty, target.parse("[try{}catch(err, msg){ if error }]")); - Assert.AreEqual(Value.Empty, target.parse("[try{}catch(){ }]")); - Assert.AreEqual(0, uvar.Variables.Count()); - } - - [TestMethod] - public void parseTest2() - { - var target = new TryComponent(new StubEnv(), new UserVariable()); - - Assert.AreEqual(Value.Empty, target.parse("[try\n{}\ncatch\n{ if error }]")); - Assert.AreEqual(Value.Empty, target.parse("[try\n{}\n catch\n { \n} ]")); - } - - [TestMethod] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest3() - { - var target = new TryComponent(new StubEnv(), new UserVariable()); - target.parse("[try{ }]"); - } - - [TestMethod] - [ExpectedException(typeof(NotSupportedOperationException))] - public void parseTest4() - { - var target = new TryComponent(new StubEnv(), new UserVariable()); - target.parse("[try{ #[notrealcomponentToError] }catch('err', 'msg'){ }]"); - } - - [TestMethod] - public void catchTest1() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - target.parse("#[try{ $(test = '123') }catch{ $(test2 = '456') }]"); - - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("123", uvar.get("test", null)); - } - - [TestMethod] - public void catchTest2() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual(0, uvar.Variables.Count()); - target.parse("#[try{ #[notrealcomponentToError] $(test = '123') }catch{ $(test2 = '456') }]"); - - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("456", uvar.get("test2", null)); - } - - [TestMethod] - public void catchTest3() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual(0, uvar.Variables.Count()); - target.parse(@" - #[( false ){ - - #[try - { - #[notrealcomponentToError] - } - catch(err, msg) - { - $(test1 = '123') - }] - - } - else{ - - #[try - { - #[notrealcomponentToError] - } - catch(err, msg) - { - $(test2 = '456') - $(exErr = $(err)) - $(exMsg = $(msg)) - }] - - }] "); - - Assert.AreEqual(3, uvar.Variables.Count()); - Assert.AreEqual(null, uvar.get("test1", null)); - Assert.AreEqual("456", uvar.get("test2", null)); - Assert.AreEqual(true, !string.IsNullOrWhiteSpace(uvar.get("exErr", null))); - Assert.AreEqual(true, !string.IsNullOrWhiteSpace(uvar.get("exMsg", null))); - Assert.AreEqual(null, uvar.get("err", null)); - Assert.AreEqual(null, uvar.get("msg", null)); - } - - [TestMethod] - public void catchTest4() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual(0, uvar.Variables.Count()); - target.parse(@" - #[( false ){ - - #[try - { - #[notrealcomponentToError] - } - catch - { - $(test1 = '123') - }] - - } - else{ - - #[try - { - #[notrealcomponentToError] - } - catch - { - $(test2 = '456') - }] - - }] "); - - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual(null, uvar.get("test1", null)); - Assert.AreEqual("456", uvar.get("test2", null)); - Assert.AreEqual(null, uvar.get("err", null)); - Assert.AreEqual(null, uvar.get("msg", null)); - } - - [TestMethod] - public void catchTest5() - { - var uvar = new UserVariable(); - var target = new Script(new StubEnv(), uvar); - - Assert.AreEqual(0, uvar.Variables.Count()); - target.parse(@" - #[try - { - #[notrealcomponentToError] - - #[( true ){ - $(test1 = '123') - }] - } - catch - { - #[( true ){ - $(test2 = '456') - }] - }] - "); - - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual(null, uvar.get("test1", null)); - Assert.AreEqual("456", uvar.get("test2", null)); - } - - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/Components/UserVariableComponentTest.cs b/vsSolutionBuildEventTest/SBEScripts/Components/UserVariableComponentTest.cs deleted file mode 100644 index 19a333cf..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/Components/UserVariableComponentTest.cs +++ /dev/null @@ -1,198 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Components; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.Test.SBEScripts.Components -{ - /// - ///This is a test class for UserVariableComponentTest and is intended - ///to contain all UserVariableComponentTest Unit Tests - /// - [TestClass()] - public class UserVariableComponentTest - { - private TestContext testContextInstance; - private IEnvironment envmock = (new Mock()).Object; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest() - { - UserVariableComponent target = new UserVariableComponent(envmock, new UserVariable()); - target.parse("#[var name = value]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest2() - { - UserVariableComponent target = new UserVariableComponent(envmock, new UserVariable()); - target.parse("var name = value"); - } - - /// - ///A test for parse -> '-' operation - /// - [TestMethod()] - [ExpectedException(typeof(NotFoundException))] - public void parseTest3() - { - UserVariableComponentAccessor target = new UserVariableComponentAccessor(envmock, new UserVariable()); - Assert.AreEqual(Value.Empty, target.parse("[var name = value]")); - Assert.AreEqual(Value.Empty, target.parse("[var -name]")); - Assert.AreEqual("[E1:value]", target.parse("[var name]")); - } - - /// - ///A test for parse -> '-' operation - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest4() - { - UserVariableComponentAccessor target = new UserVariableComponentAccessor(envmock, new UserVariable()); - Assert.AreEqual(Value.Empty, target.parse("[var name = value]")); - Assert.AreEqual(Value.Empty, target.parse("[var -name = value]")); - } - - /// - ///A test for parse -> '+' operation - /// - [TestMethod()] - public void parseTest5() - { - UserVariableComponentAccessor target = new UserVariableComponentAccessor(envmock, new UserVariable()); - Assert.AreEqual(Value.Empty, target.parse("[var name = value]")); - Assert.AreEqual(Value.Empty, target.parse("[var +name]")); - Assert.AreEqual(String.Format("[E1:{0}]", UserVariableComponent.UVARIABLE_VALUE_DEFAULT), target.parse("[var name]")); - } - - /// - ///A test for parse -> '+' operation - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest6() - { - UserVariableComponentAccessor target = new UserVariableComponentAccessor(envmock, new UserVariable()); - Assert.AreEqual(Value.Empty, target.parse("[var name = value]")); - Assert.AreEqual(Value.Empty, target.parse("[var +name = value]")); - } - - /// - ///A test for parse -> '-' operation - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest7() - { - UserVariableComponentAccessor target = new UserVariableComponentAccessor(envmock, new UserVariable()); - Assert.AreEqual(Value.Empty, target.parse("[var name = value]")); - Assert.AreEqual(Value.Empty, target.parse("[var -name = value]")); - } - - /// - ///A test for parse -> '+' operation - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void parseTest8() - { - UserVariableComponentAccessor target = new UserVariableComponentAccessor(envmock, new UserVariable()); - Assert.AreEqual(Value.Empty, target.parse("[var + name]")); - } - - /// - ///A test for std - /// - [TestMethod()] - [ExpectedException(typeof(NotFoundException))] - public void stdTest1() - { - UserVariableComponent target = new UserVariableComponent(envmock, new UserVariable()); - target.parse("[var name]"); - } - - /// - ///A test for std - /// - [TestMethod()] - public void stdTest2() - { - UserVariableComponentAccessor target = new UserVariableComponentAccessor(envmock, new UserVariable()); - Assert.AreEqual(Value.Empty, target.parse("[var name = value]")); - Assert.AreEqual("[E1:value]", target.parse("[var name]")); - } - - /// - ///A test for std - /// - [TestMethod()] - public void stdTest3() - { - UserVariableComponentAccessor target = new UserVariableComponentAccessor(envmock, new UserVariable()); - Assert.AreEqual(Value.Empty, target.parse("[var name = line1 \n line2]")); - Assert.AreEqual("[E1:line1 \n line2]", target.parse("[var name]")); - } - - /// - ///A test for std - /// - [TestMethod()] - public void stdTest4() - { - UserVariableComponentAccessor target = new UserVariableComponentAccessor(envmock, new UserVariable()); - Assert.AreEqual(Value.Empty, target.parse("[var name = value]")); - Assert.AreEqual(Value.Empty, target.parse("[var name = value2]")); - Assert.AreEqual("[E1:value2]", target.parse("[var name]")); - } - - private class UserVariableComponentAccessor: UserVariableComponent - { - public UserVariableComponentAccessor(IEnvironment env, IUserVariable uvariable): base(env, uvariable) - { - - } - - protected override void evaluate(string name, string project = null) - { - uvariable.evaluate(name, project, new Evaluator1(), true); - } - } - - private class Evaluator1: IEvaluator - { - public string evaluate(string data) - { - return String.Format("[E1:{0}]", data); - } - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/RPatternTest.cs b/vsSolutionBuildEventTest/SBEScripts/RPatternTest.cs deleted file mode 100644 index fdd2e095..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/RPatternTest.cs +++ /dev/null @@ -1,361 +0,0 @@ -using System.Text.RegularExpressions; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.SBEScripts; - -namespace net.r_eg.vsSBE.Test.SBEScripts -{ - /// - ///This is a test class for RPatternTest and is intended - ///to contain all RPatternTest Unit Tests - /// - [TestClass()] - public class RPatternTest - { - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - /// - ///A test for SquareBracketsContent - /// - [TestMethod()] - public void SquareBracketsContentTest() - { - string data = " #[var name] "; - Match actual = Regex.Match(data, RPattern.SquareBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(true, actual.Success); - Assert.AreEqual("var name", actual.Groups[1].Value); - } - - /// - ///A test for SquareBracketsContent - /// - [TestMethod()] - public void SquareBracketsContentTest2() - { - string data = " [ test [name [ data] ]] "; - Match actual = Regex.Match(data, RPattern.SquareBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(true, actual.Success); - Assert.AreEqual(" test [name [ data] ]", actual.Groups[1].Value); - } - - /// - ///A test for SquareBracketsContent - /// - [TestMethod()] - public void SquareBracketsContentTest3() - { - string data = " [ test name [ data] p]] "; - Match actual = Regex.Match(data, RPattern.SquareBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(true, actual.Success); - Assert.AreEqual(" test name [ data] p", actual.Groups[1].Value); - } - - /// - ///A test for SquareBracketsContent - /// - [TestMethod()] - public void SquareBracketsContentTest4() - { - string data = " data] [test "; - bool actual = Regex.IsMatch(data, RPattern.SquareBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(false, actual); - } - - /// - ///A test for SquareBracketsContent - /// - [TestMethod()] - public void SquareBracketsContentTest5() - { - string data = " data "; - bool actual = Regex.IsMatch(data, RPattern.SquareBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(false, actual); - } - - /// - ///A test for RoundBracketsContent - /// - [TestMethod()] - public void RoundBracketsContentTest() - { - string data = " $(var name) "; - Match actual = Regex.Match(data, RPattern.RoundBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(true, actual.Success); - Assert.AreEqual("var name", actual.Groups[1].Value); - } - - /// - ///A test for RoundBracketsContent - /// - [TestMethod()] - public void RoundBracketsContentTest2() - { - string data = " ( test (name ( data) )) "; - Match actual = Regex.Match(data, RPattern.RoundBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(true, actual.Success); - Assert.AreEqual(" test (name ( data) )", actual.Groups[1].Value); - } - - /// - ///A test for RoundBracketsContent - /// - [TestMethod()] - public void RoundBracketsContentTest3() - { - string data = " ( test name ( data) p)) "; - Match actual = Regex.Match(data, RPattern.RoundBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(true, actual.Success); - Assert.AreEqual(" test name ( data) p", actual.Groups[1].Value); - } - - /// - ///A test for RoundBracketsContent - /// - [TestMethod()] - public void RoundBracketsContentTest4() - { - string data = " data) (test "; - bool actual = Regex.IsMatch(data, RPattern.RoundBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(false, actual); - } - - /// - ///A test for RoundBracketsContent - /// - [TestMethod()] - public void RoundBracketsContentTest5() - { - string data = " data "; - bool actual = Regex.IsMatch(data, RPattern.RoundBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(false, actual); - } - - /// - ///A test for CurlyBracketsContent - /// - [TestMethod()] - public void CurlyBracketsContentTest() - { - string data = " { body1 } "; - Match actual = Regex.Match(data, RPattern.CurlyBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(true, actual.Success); - Assert.AreEqual(" body1 ", actual.Groups[1].Value); - } - - /// - ///A test for CurlyBracketsContent - /// - [TestMethod()] - public void CurlyBracketsContentTest2() - { - string data = " { test {name { data} }} "; - Match actual = Regex.Match(data, RPattern.CurlyBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(true, actual.Success); - Assert.AreEqual(" test {name { data} }", actual.Groups[1].Value); - } - - /// - ///A test for CurlyBracketsContent - /// - [TestMethod()] - public void CurlyBracketsContentTest3() - { - string data = " { test name { data} p}} "; - Match actual = Regex.Match(data, RPattern.CurlyBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(true, actual.Success); - Assert.AreEqual(" test name { data} p", actual.Groups[1].Value); - } - - /// - ///A test for CurlyBracketsContent - /// - [TestMethod()] - public void CurlyBracketsContentTest4() - { - string data = " data} {test "; - bool actual = Regex.IsMatch(data, RPattern.CurlyBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(false, actual); - } - - /// - ///A test for CurlyBracketsContent - /// - [TestMethod()] - public void CurlyBracketsContentTest5() - { - string data = " data "; - bool actual = Regex.IsMatch(data, RPattern.CurlyBracketsContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(false, actual); - } - - /// - ///A test for DoubleQuotesContent - /// - [TestMethod()] - public void DoubleQuotesContentTest() - { - string data = " test \"123\" "; - Match actual = Regex.Match(data, RPattern.DoubleQuotesContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(true, actual.Success); - Assert.AreEqual("123", actual.Groups[1].Value); - } - - /// - ///A test for DoubleQuotesContent - /// - [TestMethod()] - public void DoubleQuotesContentTest2() - { - string data = " test \\\"123\\\" "; // \"data\" - bool actual = Regex.IsMatch(data, RPattern.DoubleQuotesContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(false, actual); - } - - /// - ///A test for DoubleQuotesContent - /// - [TestMethod()] - public void DoubleQuotesContentTest3() - { - string data = " test 123\" "; - Assert.AreEqual(false, Regex.IsMatch(data, RPattern.DoubleQuotesContent, RegexOptions.IgnorePatternWhitespace)); - } - - /// - ///A test for DoubleQuotesContent - /// - [TestMethod()] - public void DoubleQuotesContentTest4() - { - string data = "\"\\\",\"p\""; //-> "\","p" - string expected = "\\\","; //-> \", - Assert.AreEqual(expected, Regex.Match(data, RPattern.DoubleQuotesContent, RegexOptions.IgnorePatternWhitespace).Groups[1].Value); - } - - /// - ///A test for DoubleQuotesContent - /// - [TestMethod()] - public void DoubleQuotesContentTest5() - { - string data = "\"\\\\\",\"p\""; //-> "\\","p" - string expected = "\\\\"; //-> \\ - Assert.AreEqual(expected, Regex.Match(data, RPattern.DoubleQuotesContent, RegexOptions.IgnorePatternWhitespace).Groups[1].Value); - } - - /// - ///A test for DoubleQuotesContent - /// - [TestMethod()] - public void DoubleQuotesContentTest6() - { - string data = "\"\\ \",\"p\""; //-> "\ ","p" - string expected = "\\ "; //-> \ - Assert.AreEqual(expected, Regex.Match(data, RPattern.DoubleQuotesContent, RegexOptions.IgnorePatternWhitespace).Groups[1].Value); - } - - /// - ///A test for DoubleQuotesContent - /// - [TestMethod()] - public void DoubleQuotesContentTest7() - { - string data = "\"\\\\\\\",\"p\""; //-> "\\\","p" - string expected = "\\\\\\\","; //-> \\\", - Assert.AreEqual(expected, Regex.Match(data, RPattern.DoubleQuotesContent, RegexOptions.IgnorePatternWhitespace).Groups[1].Value); - } - - /// - ///A test for SingleQuotesContent - /// - [TestMethod()] - public void SingleQuotesContentTest() - { - string data = " test '123' "; - Match actual = Regex.Match(data, RPattern.SingleQuotesContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(true, actual.Success); - Assert.AreEqual("123", actual.Groups[1].Value); - } - - /// - ///A test for SingleQuotesContent - /// - [TestMethod()] - public void SingleQuotesContentTest2() - { - string data = " test \\'123\\' "; // \'data\' - bool actual = Regex.IsMatch(data, RPattern.SingleQuotesContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(false, actual); - } - - /// - ///A test for SingleQuotesContent - /// - [TestMethod()] - public void SingleQuotesContentTest3() - { - string data = " test 123' "; - bool actual = Regex.IsMatch(data, RPattern.SingleQuotesContent, RegexOptions.IgnorePatternWhitespace); - Assert.AreEqual(false, actual); - } - - /// - ///A test for SingleQuotesContent - /// - [TestMethod()] - public void SingleQuotesContentTest4() - { - string data = "'\\','p'"; //-> '\','p' - string expected = "\\',"; //-> \', - Assert.AreEqual(expected, Regex.Match(data, RPattern.SingleQuotesContent, RegexOptions.IgnorePatternWhitespace).Groups[1].Value); - } - - /// - ///A test for SingleQuotesContent - /// - [TestMethod()] - public void SingleQuotesContentTest5() - { - string data = "'\\\\','p'"; //-> '\\','p' - string expected = "\\\\"; //-> \\ - Assert.AreEqual(expected, Regex.Match(data, RPattern.SingleQuotesContent, RegexOptions.IgnorePatternWhitespace).Groups[1].Value); - } - - /// - ///A test for SingleQuotesContent - /// - [TestMethod()] - public void SingleQuotesContentTest6() - { - string data = "'\\ ','p'"; //-> '\ ','p' - string expected = "\\ "; //-> \ - Assert.AreEqual(expected, Regex.Match(data, RPattern.SingleQuotesContent, RegexOptions.IgnorePatternWhitespace).Groups[1].Value); - } - - /// - ///A test for SingleQuotesContent - /// - [TestMethod()] - public void SingleQuotesContentTest7() - { - string data = "'\\\\\\','p'"; //-> '\\\','p' - string expected = "\\\\\\',"; //-> \\\', - Assert.AreEqual(expected, Regex.Match(data, RPattern.SingleQuotesContent, RegexOptions.IgnorePatternWhitespace).Groups[1].Value); - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/SNode/LevelTest.cs b/vsSolutionBuildEventTest/SBEScripts/SNode/LevelTest.cs deleted file mode 100644 index 5d6c376e..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/SNode/LevelTest.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; - -namespace net.r_eg.vsSBE.Test.SBEScripts.SNode -{ - [TestClass()] - public class LevelTest - { - /// - ///A test for Is - /// - [TestMethod()] - public void IsTest1() - { - ILevel level = new Level() - { - Data = "hash", - Type = LevelType.Method, - Args = new Argument[2] { - new Argument() { - data = "abcd123", - type = ArgumentType.StringDouble - }, - new Argument() { - data = "true", - type = ArgumentType.Boolean - } } - }; - - Assert.AreEqual(true, level.Is(ArgumentType.StringDouble, ArgumentType.Boolean)); - Assert.AreEqual(false, level.Is(ArgumentType.StringDouble)); - Assert.AreEqual(false, level.Is(ArgumentType.StringDouble, ArgumentType.Boolean, ArgumentType.Boolean)); - Assert.AreEqual(false, level.Is()); - Assert.AreEqual(false, level.Is(ArgumentType.Boolean, ArgumentType.StringDouble)); - } - - /// - ///A test for Is - /// - [TestMethod()] - public void IsTest2() - { - ILevel level = new Level() - { - Data = "hash", - Type = LevelType.Method, - Args = new Argument[2] { - new Argument() { - data = "abcd123", - type = ArgumentType.StringDouble - }, - new Argument() { - data = "true", - type = ArgumentType.Boolean - } } - }; - - Assert.AreEqual(true, level.Is(null, ArgumentType.StringDouble, ArgumentType.Boolean)); - Assert.AreEqual(false, level.Is(null, ArgumentType.StringDouble)); - Assert.AreEqual(false, level.Is(null, ArgumentType.StringDouble, ArgumentType.Boolean, ArgumentType.Boolean)); - Assert.AreEqual(false, level.Is(null, null)); - Assert.AreEqual(false, level.Is(null, ArgumentType.Boolean, ArgumentType.StringDouble)); - } - - /// - ///A test for Is - /// - [TestMethod()] - public void IsTest3() - { - ILevel level = new Level() - { - Data = "hash", - Type = LevelType.Method, - Args = new Argument[2] { - new Argument() { - data = "abcd123", - type = ArgumentType.StringDouble - }, - new Argument() { - data = "true", - type = ArgumentType.Boolean - } } - }; - - Assert.AreEqual(true, level.Is("hash", ArgumentType.StringDouble, ArgumentType.Boolean)); //should be without exception - - try { - Assert.AreEqual(false, level.Is("hash", ArgumentType.StringDouble)); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - Assert.AreEqual(false, level.Is("hash", ArgumentType.StringDouble, ArgumentType.Boolean, ArgumentType.Boolean)); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - Assert.AreEqual(false, level.Is("hash", null)); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - Assert.AreEqual(false, level.Is("hash", ArgumentType.Boolean, ArgumentType.StringDouble)); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - /// - ///A test for Is - /// - [TestMethod()] - public void IsTest4() - { - ILevel level = new Level() - { - Data = "hash", - Type = LevelType.Method, - Args = null - }; - - Assert.AreEqual(false, level.Is()); - Assert.AreEqual(false, level.Is(ArgumentType.StringDouble, ArgumentType.Boolean)); - } - - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/SNode/PMTest.cs b/vsSolutionBuildEventTest/SBEScripts/SNode/PMTest.cs deleted file mode 100644 index bdf7843f..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/SNode/PMTest.cs +++ /dev/null @@ -1,1001 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.SBEScripts.SNode; - -namespace net.r_eg.vsSBE.Test.SBEScripts.SNode -{ - [TestClass] - public class PMTest - { - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest1() - { - IPM pm = new PM("solution.path(\"sln file\").Last"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[1].Data, "path"); - Assert.AreEqual(pm.Levels[1].Args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[1].Args[0].data, "sln file"); - - Assert.AreEqual(pm.Levels[2].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[2].Data, "Last"); - - Assert.AreEqual(pm.Levels[3].Type, LevelType.RightOperandEmpty); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest2() - { - IPM pm = new PM("solution.current.FirstBy(true, 0, \"raw\")"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[1].Data, "current"); - - Assert.AreEqual(pm.Levels[2].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[2].Data, "FirstBy"); - Assert.AreEqual(pm.Levels[2].Args[0].type, ArgumentType.Boolean); - Assert.AreEqual(pm.Levels[2].Args[0].data, true); - Assert.AreEqual(pm.Levels[2].Args[1].type, ArgumentType.Integer); - Assert.AreEqual(pm.Levels[2].Args[1].data, 0); - Assert.AreEqual(pm.Levels[2].Args[2].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[2].Args[2].data, "raw"); - - Assert.AreEqual(pm.Levels[3].Type, LevelType.RightOperandEmpty); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest3() - { - IPM pm = new PM(".solution"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.RightOperandEmpty); - } - - /// - ///A test for detect - /// - [TestMethod()] - [ExpectedException(typeof(SyntaxIncorrectException))] - public void detectTest4() - { - IPM pm = new PM(".solution."); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest5() - { - IPM pm = new PM(". solution . data = true"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - Assert.AreEqual(pm.Levels[1].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[1].Data, "data"); - - Assert.AreEqual(pm.Levels[2].Type, LevelType.RightOperandStd); - Assert.AreEqual(pm.Levels[2].Data, " true"); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest6() - { - IPM pm = new PM("solution.data : 123 "); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - Assert.AreEqual(pm.Levels[1].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[1].Data, "data"); - - Assert.AreEqual(pm.Levels[2].Type, LevelType.RightOperandColon); - Assert.AreEqual(pm.Levels[2].Data, " 123 "); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest7() - { - IPM pm = new PM("solution = "); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.RightOperandStd); - Assert.AreEqual(pm.Levels[1].Data, " "); - - pm = new PM("solution ="); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.RightOperandStd); - Assert.AreEqual(pm.Levels[1].Data, ""); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest8() - { - IPM pm = new PM("solution() : "); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[0].Args.Length, 0); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.RightOperandColon); - Assert.AreEqual(pm.Levels[1].Data, " "); - - pm = new PM("solution(123) :456"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[0].Args[0].type, ArgumentType.Integer); - Assert.AreEqual(pm.Levels[0].Args[0].data, 123); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.RightOperandColon); - Assert.AreEqual(pm.Levels[1].Data, "456"); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest9() - { - IPM pm = new PM("left.solution(\" test , args\", 123, true, ' n1 , n2 ').right"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "left"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[1].Args.Length, 4); - Assert.AreEqual(pm.Levels[1].Args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[1].Args[0].data, " test , args"); - Assert.AreEqual(pm.Levels[1].Args[1].type, ArgumentType.Integer); - Assert.AreEqual(pm.Levels[1].Args[1].data, 123); - Assert.AreEqual(pm.Levels[1].Args[2].type, ArgumentType.Boolean); - Assert.AreEqual(pm.Levels[1].Args[2].data, true); - Assert.AreEqual(pm.Levels[1].Args[3].type, ArgumentType.StringSingle); - Assert.AreEqual(pm.Levels[1].Args[3].data, " n1 , n2 "); - Assert.AreEqual(pm.Levels[1].Data, "solution"); - - Assert.AreEqual(pm.Levels[2].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[2].Data, "right"); - - Assert.AreEqual(pm.Levels[3].Type, LevelType.RightOperandEmpty); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest10() - { - try { - IPM pm = new PM("solution(123, ).right"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(SyntaxIncorrectException), ex.GetType().ToString()); } - - try { - IPM pm = new PM("solution(, 123).right"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(SyntaxIncorrectException), ex.GetType().ToString()); } - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest11() - { - IPM pm = new PM("solution=left.right"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.RightOperandStd); - Assert.AreEqual(pm.Levels[1].Data, "left.right"); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest12() - { - IPM pm = new PM("solution.path(\"D:/app/name.sln\").projectBy(\"4262A1DC\")"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[1].Data, "path"); - Assert.AreEqual(pm.Levels[1].Args.Length, 1); - Assert.AreEqual(pm.Levels[1].Args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[1].Args[0].data, "D:/app/name.sln"); - - Assert.AreEqual(pm.Levels[2].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[2].Data, "projectBy"); - Assert.AreEqual(pm.Levels[2].Args.Length, 1); - Assert.AreEqual(pm.Levels[2].Args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[2].Args[0].data, "4262A1DC"); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest13() - { - IPM pm = new PM("solution.path(\"D:/app/name.sln\", \"test\").projectBy(\"4262A1DC\")"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[1].Data, "path"); - Assert.AreEqual(pm.Levels[1].Args.Length, 2); - Assert.AreEqual(pm.Levels[1].Args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[1].Args[0].data, "D:/app/name.sln"); - Assert.AreEqual(pm.Levels[1].Args[1].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[1].Args[1].data, "test"); - - Assert.AreEqual(pm.Levels[2].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[2].Data, "projectBy"); - Assert.AreEqual(pm.Levels[2].Args.Length, 1); - Assert.AreEqual(pm.Levels[2].Args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[2].Args[0].data, "4262A1DC"); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest14() - { - IPM pm = new PM("left.solution(\" test , (args)\", 123, true, ' (n1) , n2) ').right"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "left"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[1].Args.Length, 4); - Assert.AreEqual(pm.Levels[1].Args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[1].Args[0].data, " test , (args)"); - Assert.AreEqual(pm.Levels[1].Args[1].type, ArgumentType.Integer); - Assert.AreEqual(pm.Levels[1].Args[1].data, 123); - Assert.AreEqual(pm.Levels[1].Args[2].type, ArgumentType.Boolean); - Assert.AreEqual(pm.Levels[1].Args[2].data, true); - Assert.AreEqual(pm.Levels[1].Args[3].type, ArgumentType.StringSingle); - Assert.AreEqual(pm.Levels[1].Args[3].data, " (n1) , n2) "); - Assert.AreEqual(pm.Levels[1].Data, "solution"); - - Assert.AreEqual(pm.Levels[2].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[2].Data, "right"); - - Assert.AreEqual(pm.Levels[3].Type, LevelType.RightOperandEmpty); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest15() - { - IPM pm = new PM("solution.path(\"D:/app/(name)).sln\", \"test\").projectBy(\"426(2)A1DC\") : \"test 123\", 'true'"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[1].Data, "path"); - Assert.AreEqual(pm.Levels[1].Args.Length, 2); - Assert.AreEqual(pm.Levels[1].Args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[1].Args[0].data, "D:/app/(name)).sln"); - Assert.AreEqual(pm.Levels[1].Args[1].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[1].Args[1].data, "test"); - - Assert.AreEqual(pm.Levels[2].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[2].Data, "projectBy"); - Assert.AreEqual(pm.Levels[2].Args.Length, 1); - Assert.AreEqual(pm.Levels[2].Args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[2].Args[0].data, "426(2)A1DC"); - - Assert.AreEqual(pm.Levels[3].Type, LevelType.RightOperandColon); - Assert.AreEqual(pm.Levels[3].Data, " \"test 123\", 'true'"); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest16() - { - IPM pm = new PM("solution = \"te()st 123\"), 'true'"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.RightOperandStd); - Assert.AreEqual(pm.Levels[1].Data, " \"te()st 123\"), 'true'"); - - pm = new PM("solution : \"te()st 123\"), 'true'"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.RightOperandColon); - Assert.AreEqual(pm.Levels[1].Data, " \"te()st 123\"), 'true'"); - } - - /// - ///A test for detect - /// - [TestMethod()] - public void detectTest17() - { - IPM pm = new PM("solution.path(\"\\\"D:/app/(name)).sln\\\"\", \"\\\"test\\\"\", '\\\"12 34\\\"').projectBy(\"\\\"426(2)A1DC\\\"\") : \"\\\"test 123\\\"\", '\\\"true\\\"'"); - - Assert.AreEqual(pm.Levels[0].Type, LevelType.Property); - Assert.AreEqual(pm.Levels[0].Data, "solution"); - - Assert.AreEqual(pm.Levels[1].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[1].Data, "path"); - Assert.AreEqual(pm.Levels[1].Args.Length, 3); - Assert.AreEqual(pm.Levels[1].Args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[1].Args[0].data, "\"D:/app/(name)).sln\""); - Assert.AreEqual(pm.Levels[1].Args[1].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[1].Args[1].data, "\"test\""); - Assert.AreEqual(pm.Levels[1].Args[2].type, ArgumentType.StringSingle); - Assert.AreEqual(pm.Levels[1].Args[2].data, "\\\"12 34\\\""); - - Assert.AreEqual(pm.Levels[2].Type, LevelType.Method); - Assert.AreEqual(pm.Levels[2].Data, "projectBy"); - Assert.AreEqual(pm.Levels[2].Args.Length, 1); - Assert.AreEqual(pm.Levels[2].Args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(pm.Levels[2].Args[0].data, "\"426(2)A1DC\""); - - Assert.AreEqual(pm.Levels[3].Type, LevelType.RightOperandColon); - Assert.AreEqual(pm.Levels[3].Data, " \"\\\"test 123\\\"\", '\\\"true\\\"'"); - } - - [TestMethod] - public void FirstLevelTest1() - { - IPM pm = new PM("left.solution.right"); - - Assert.AreEqual(pm.FirstLevel.Data, pm.Levels[0].Data); - Assert.AreEqual(pm.FirstLevel.Type, pm.Levels[0].Type); - - pm.pinTo(2); - Assert.AreEqual(pm.FirstLevel.Data, pm.Levels[0].Data); - Assert.AreEqual(pm.FirstLevel.Type, pm.Levels[0].Type); - } - - [TestMethod] - [ExpectedException(typeof(InvalidArgumentException))] - public void FirstLevelTest2() - { - IPM pm = new PM(new List()); - Assert.AreEqual(0, pm.Levels.Count); - - var lvl = pm.FirstLevel; - } - - [TestMethod] - public void FirstLevelTest3() - { - IPM pm = new PM("left.solution.right"); - - Assert.AreEqual("left", pm.Levels[0].Data); - - string newData = "Test"; - pm.Levels[0] = new Level() { - Data = newData - }; - - Assert.AreEqual(newData, pm.Levels[0].Data); - } - - [TestMethod] - [ExpectedException(typeof(InvalidArgumentException))] - public void FirstLevelTest4() - { - IPM pm = new PM(new List()); - Assert.AreEqual(0, pm.Levels.Count); - - pm.FirstLevel = new Level() { }; - } - - /// - ///A test for Is - /// - [TestMethod] - public void IsTest1() - { - IPM pm = new PM("solution=left.right"); - - Assert.AreEqual(pm.Is(100, LevelType.Property, "solution"), false); - Assert.AreEqual(pm.Is(-1, LevelType.Property, "solution"), false); - Assert.AreEqual(pm.Is(0, LevelType.Property, "solution"), true); - Assert.AreEqual(pm.Is(1, LevelType.RightOperandStd, "left.right"), true); - } - - /// - ///A test for Is - /// - [TestMethod()] - public void IsTest2() - { - IPM pm = new PM("solution.m1().m2().right"); - - Assert.AreEqual(pm.Is(0, LevelType.Property, "solution"), true); - Assert.AreEqual(pm.Is(1, LevelType.Method, "m1"), true); - Assert.AreEqual(pm.Is(2, LevelType.Method, "m2"), true); - Assert.AreEqual(pm.Is(3, LevelType.Property, "right"), true); - Assert.AreEqual(pm.Is(4, LevelType.RightOperandEmpty), true); - } - - /// - ///A test for Is - /// - [TestMethod()] - public void IsTest3() - { - IPM pm = new PM("solution.m1(')', '(', \"(\").m2(123, \" -> )\").right"); - - Assert.AreEqual(pm.Is(0, LevelType.Property, "solution"), true); - Assert.AreEqual(pm.Is(1, LevelType.Method, "m1"), true); - Assert.AreEqual(pm.Is(2, LevelType.Method, "m2"), true); - Assert.AreEqual(pm.Is(3, LevelType.Property, "right"), true); - Assert.AreEqual(pm.Is(4, LevelType.RightOperandEmpty), true); - } - - /// - ///A test for It - /// - [TestMethod()] - public void ItTest1() - { - IPM pm = new PM("solution.m1().right"); - - Assert.AreEqual(true, pm.It(LevelType.Property, "solution")); - Assert.AreEqual(true, pm.It(LevelType.Method, "m1")); - Assert.AreEqual(false, pm.It(LevelType.Property, "notRealProperty")); - Assert.AreEqual(true, pm.It(LevelType.Property, "right")); - Assert.AreEqual(true, pm.It(LevelType.RightOperandEmpty)); - - Assert.AreEqual(0, pm.Levels.Count); - Assert.AreEqual(false, pm.It(LevelType.RightOperandEmpty)); - Assert.AreEqual(false, pm.Is(0, LevelType.RightOperandEmpty)); - } - - /// - ///A test for It - /// - [TestMethod()] - public void ItTest2() - { - IPM pm = new PM("solution.m1().Prop1.right"); - - Assert.AreEqual(true, pm.It(LevelType.Property, "solution")); - Assert.AreEqual(true, pm.Is(LevelType.Method, "m1")); - Assert.AreEqual(false, pm.It(LevelType.Property, "Prop1")); - Assert.AreEqual(true, pm.It(1, LevelType.Property, "Prop1")); - Assert.AreEqual(true, pm.It(LevelType.Property, "right")); - } - - /// - ///A test for FinalIs - /// - [TestMethod()] - public void FinalIsTest1() - { - IPM pm = new PM("left.solution.right"); - Assert.AreEqual(pm.Levels.Count, 4); - Assert.AreEqual(pm.FinalIs(2, LevelType.Property, "right"), true); - Assert.AreEqual(pm.FinalIs(3, LevelType.RightOperandEmpty), true); - } - - /// - ///A test for FinalIs - /// - [TestMethod()] - public void FinalIsTest2() - { - try { - IPM pm = new PM("left.solution.right"); - Assert.AreEqual(pm.FinalIs(1, LevelType.Property, "solution"), true); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - IPM pm = new PM("left.solution.right"); - Assert.AreEqual(pm.FinalIs(LevelType.Property, "left"), true); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - } - - /// - ///A test for FinalIs - /// - [TestMethod()] - public void FinalIsTest3() - { - IPM pm = new PM("left.solution.right"); - Assert.AreEqual(pm.Is(0, LevelType.Property, "right"), false); - Assert.AreEqual(pm.FinalIs(1, LevelType.Property, "right"), false); - Assert.AreEqual(pm.Is(2, LevelType.Property, "right"), true); - } - - /// - ///A test for FinalIs - /// - [TestMethod()] - public void FinalIsTest4() - { - IPM pm = new PM("left.solution().right"); - Assert.AreEqual(pm.Is(0, LevelType.Property, "left"), true); - Assert.AreEqual(pm.Is(1, LevelType.Method, "solution"), true); - Assert.AreEqual(pm.FinalIs(2, LevelType.Property, "right"), true); - } - - /// - ///A test for FinalIs - /// - [TestMethod()] - public void FinalIsTest5() - { - IPM pm = new PM("left.solution(\" (a, b) \").right"); - Assert.AreEqual(pm.Is(0, LevelType.Property, "left"), true); - Assert.AreEqual(pm.Is(1, LevelType.Method, "solution"), true); - Assert.AreEqual(pm.FinalIs(2, LevelType.Property, "right"), true); - } - - /// - ///A test for FinalEmptyIs - /// - [TestMethod()] - public void FinalEmptyIsTest1() - { - IPM pm = new PM("solution.right "); - Assert.AreEqual(pm.FinalEmptyIs(1, LevelType.Property, "right"), true); - Assert.AreEqual(pm.FinalEmptyIs(2, LevelType.RightOperandEmpty), true); - } - - /// - ///A test for FinalEmptyIs - /// - [TestMethod()] - public void FinalEmptyIsTest2() - { - try { - IPM pm = new PM("solution.right = "); - Assert.AreEqual(pm.FinalEmptyIs(1, LevelType.Property, "right"), true); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - IPM pm = new PM("solution.right : "); - Assert.AreEqual(pm.FinalEmptyIs(1, LevelType.Property, "right"), true); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - IPM pm = new PM("solution.right . prop"); - Assert.AreEqual(pm.FinalEmptyIs(1, LevelType.Property, "right"), true); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - - try { - IPM pm = new PM("solution.right mixed data"); - Assert.AreEqual(pm.FinalEmptyIs(1, LevelType.Property, "right"), true); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } - } - - /// - ///A test for FinalEmptyIs - /// - [TestMethod()] - public void FinalEmptyIsTest3() - { - IPM pm = new PM("left.solution.right"); - Assert.AreEqual(pm.Is(0, LevelType.Property, "right"), false); - Assert.AreEqual(pm.FinalEmptyIs(1, LevelType.Property, "right"), false); - Assert.AreEqual(pm.Is(2, LevelType.Property, "right"), true); - } - - /// - ///A test for FinalEmptyIs - /// - [TestMethod()] - public void FinalEmptyIsTest4() - { - IPM pm = new PM("left.solution(\"test m()\")"); - Assert.AreEqual(pm.Is(0, LevelType.Property, "left"), true); - Assert.AreEqual(pm.FinalEmptyIs(1, LevelType.Method, "solution"), true); - } - - /// - ///A test for FinalEmptyIs - /// - [TestMethod()] - public void FinalEmptyIsTest5() - { - IPM pm = new PM("left.solution(\"m(1)\", \"m()\", ')', \")\", \"(\")"); - Assert.AreEqual(pm.Is(0, LevelType.Property, "left"), true); - Assert.AreEqual(pm.FinalEmptyIs(1, LevelType.Method, "solution"), true); - } - - /// - ///A test for pinTo - /// - [TestMethod()] - public void pinToTest1() - { - IPM pm = new PM("left.solution.right"); - - Assert.AreEqual(4, pm.Levels.Count); - - pm.pinTo(1); - Assert.AreEqual(3, pm.Levels.Count); - - Assert.AreEqual(pm.Is(0, LevelType.Property, "solution"), true); - Assert.AreEqual(pm.Is(1, LevelType.Property, "right"), true); - Assert.AreEqual(pm.Is(2, LevelType.RightOperandEmpty, null), true); - - pm.pinTo(2); - Assert.AreEqual(pm.Is(0, LevelType.RightOperandEmpty, null), true); - } - - /// - ///A test for pinTo - indexes - /// - [TestMethod()] - public void pinToTest2() - { - try { - IPM pm = new PM("left.solution.right"); - pm.pinTo(100); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - IPM pm = new PM("left.solution.right"); - pm.pinTo(-1); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - IPM pm = new PM("left.solution.right"); //4 - pm.pinTo(4); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - - try { - IPM pm = new PM("left.solution.right"); //4 - pm.pinTo(1); - pm.pinTo(2); - pm.pinTo(1); - Assert.Fail("5"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(InvalidArgumentException), ex.GetType().ToString()); } - } - - /// - ///A test for detectArgument - /// - [TestMethod()] - public void detectArgumentTest1() - { - IPM pm = new PM("solution(\"str data\", 'str data2', 12, -12, 1.5, -1.5, STDOUT, TestEnum.SpecialType, mixed * data, true)"); - - Assert.AreEqual(pm.Is(LevelType.Method, "solution"), true); - Assert.AreEqual(pm.Levels[0].Args.Length, 10); - - Argument[] args = pm.Levels[0].Args; - Assert.AreEqual(args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(args[0].data, "str data"); - - Assert.AreEqual(args[1].type, ArgumentType.StringSingle); - Assert.AreEqual(args[1].data, "str data2"); - - Assert.AreEqual(args[2].type, ArgumentType.Integer); - Assert.AreEqual(args[2].data, 12); - - Assert.AreEqual(args[3].type, ArgumentType.Integer); - Assert.AreEqual(args[3].data, -12); - - Assert.AreEqual(args[4].type, ArgumentType.Double); - Assert.AreEqual(args[4].data, 1.5); - - Assert.AreEqual(args[5].type, ArgumentType.Double); - Assert.AreEqual(args[5].data, -1.5); - - Assert.AreEqual(args[6].type, ArgumentType.EnumOrConst); - Assert.AreEqual(args[6].data, "STDOUT"); - - Assert.AreEqual(args[7].type, ArgumentType.EnumOrConst); - Assert.AreEqual(args[7].data, "TestEnum.SpecialType"); - - Assert.AreEqual(args[8].type, ArgumentType.Mixed); - Assert.AreEqual(args[8].data, "mixed * data"); - - Assert.AreEqual(args[9].type, ArgumentType.Boolean); - Assert.AreEqual(args[9].data, true); - } - - /// - ///A test for detectArgument - floating-point numbers - /// - [TestMethod()] - public void detectArgumentTest2() - { - IPM pm = new PM(" solution (1.5, -1.5, 1.5f, -1.5f, 1.5d, -1.5d) "); - - Assert.AreEqual(pm.Is(LevelType.Method, "solution"), true); - Assert.AreEqual(pm.Levels[0].Args.Length, 6); - - Argument[] args = pm.Levels[0].Args; - Assert.AreEqual(args[0].type, ArgumentType.Double); - Assert.AreEqual(args[0].data, 1.5d); - - Assert.AreEqual(args[1].type, ArgumentType.Double); - Assert.AreEqual(args[1].data, -1.5d); - - Assert.AreEqual(args[2].type, ArgumentType.Float); - Assert.AreEqual(args[2].data, 1.5f); - - Assert.AreEqual(args[3].type, ArgumentType.Float); - Assert.AreEqual(args[3].data, -1.5f); - - Assert.AreEqual(args[4].type, ArgumentType.Double); - Assert.AreEqual(args[4].data, 1.5d); - - Assert.AreEqual(args[5].type, ArgumentType.Double); - Assert.AreEqual(args[5].data, -1.5d); - } - - /// - ///A test for detectArgument - Object data - /// - [TestMethod()] - public void detectArgumentTest3() - { - IPM pm = new PM(" m77(\"guid\", 12, {\"p1\", {4, \"test\", 8, 'y'}, true}, {false, 'p2'}) "); - - Assert.AreEqual(pm.Is(LevelType.Method, "m77"), true); - - Argument[] args = pm.Levels[0].Args; - Assert.AreEqual(args.Length, 4); - - Assert.AreEqual(args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(args[0].data, "guid"); - - Assert.AreEqual(args[1].type, ArgumentType.Integer); - Assert.AreEqual(args[1].data, 12); - - Assert.AreEqual(args[2].type, ArgumentType.Object); - { - Argument[] args2 = (Argument[])args[2].data; - Assert.AreEqual(args2.Length, 3); - - Assert.AreEqual(args2[0].type, ArgumentType.StringDouble); - Assert.AreEqual(args2[0].data, "p1"); - - Assert.AreEqual(args2[1].type, ArgumentType.Object); - { - Argument[] args21 = (Argument[])args2[1].data; - Assert.AreEqual(args21.Length, 4); - - Assert.AreEqual(args21[0].type, ArgumentType.Integer); - Assert.AreEqual(args21[0].data, 4); - - Assert.AreEqual(args21[1].type, ArgumentType.StringDouble); - Assert.AreEqual(args21[1].data, "test"); - - Assert.AreEqual(args21[2].type, ArgumentType.Integer); - Assert.AreEqual(args21[2].data, 8); - - Assert.AreEqual(args21[3].type, ArgumentType.Char); - Assert.AreEqual(args21[3].data, 'y'); - } - - Assert.AreEqual(args2[2].type, ArgumentType.Boolean); - Assert.AreEqual(args2[2].data, true); - } - - Assert.AreEqual(args[3].type, ArgumentType.Object); - { - Argument[] args3 = (Argument[])args[3].data; - Assert.AreEqual(args3.Length, 2); - - Assert.AreEqual(args3[0].type, ArgumentType.Boolean); - Assert.AreEqual(args3[0].data, false); - - Assert.AreEqual(args3[1].type, ArgumentType.StringSingle); - Assert.AreEqual(args3[1].data, "p2"); - } - } - - /// - ///A test for detectArgument /quotes - /// - [TestMethod()] - public void detectArgumentTest4() - { - IPM pm = new PM("solution(\"str \\\" data1 \\\" \", \"str \\' data2 \\' \", 'str \\' data3 \\' ', 'str \\\" data4 \\\" ')"); - - Assert.AreEqual(pm.Is(LevelType.Method, "solution"), true); - Assert.AreEqual(pm.Levels[0].Args.Length, 4); - - Argument[] args = pm.Levels[0].Args; - Assert.AreEqual(args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(args[0].data, "str \" data1 \" "); - - Assert.AreEqual(args[1].type, ArgumentType.StringDouble); - Assert.AreEqual(args[1].data, "str \\' data2 \\' "); - - Assert.AreEqual(args[2].type, ArgumentType.StringSingle); - Assert.AreEqual(args[2].data, "str ' data3 ' "); - - Assert.AreEqual(args[3].type, ArgumentType.StringSingle); - Assert.AreEqual(args[3].data, "str \\\" data4 \\\" "); - } - - /// - ///A test for IsMethodWithArgs - /// - [TestMethod()] - public void IsMethodWithArgsTest1() - { - IPM pm = new PM("solution(\"str data\", 12, true).data.right(false, 1).end()"); - - Assert.AreEqual(true, pm.IsMethodWithArgs("solution", ArgumentType.StringDouble, ArgumentType.Integer, ArgumentType.Boolean)); - Assert.AreEqual(false, pm.IsMethodWithArgs(1, "data")); - Assert.AreEqual(true, pm.IsMethodWithArgs(2, "right", ArgumentType.Boolean, ArgumentType.Integer)); - Assert.AreEqual(true, pm.IsMethodWithArgs(3, "end")); - } - - /// - ///A test for IsRight - /// - [TestMethod()] - public void IsRightTest1() - { - IPM pm = new PM("pname = true"); - - Assert.AreEqual(true, pm.It(LevelType.Property, "pname")); - Assert.AreEqual(false, pm.IsRight(LevelType.RightOperandEmpty)); - Assert.AreEqual(false, pm.IsRight(LevelType.RightOperandColon)); - Assert.AreEqual(true, pm.IsRight(LevelType.RightOperandStd)); - } - - /// - ///A test for IsRight - /// - [TestMethod()] - public void IsRightTest2() - { - IPM pm = new PM("pname.m1(): mixed data"); - - Assert.AreEqual(true, pm.It(LevelType.Property, "pname")); - Assert.AreEqual(true, pm.It(LevelType.Method, "m1")); - Assert.AreEqual(false, pm.IsRight(LevelType.RightOperandEmpty)); - Assert.AreEqual(true, pm.IsRight(LevelType.RightOperandColon)); - Assert.AreEqual(false, pm.IsRight(LevelType.RightOperandStd)); - } - - /// - ///A test for IsData - /// - [TestMethod()] - public void IsDataTest1() - { - IPM pm = new PM("pname . m1(true, 123).right = true"); - - Assert.AreEqual(true, pm.IsData("pname")); - Assert.AreEqual(false, pm.IsData("pname ")); - pm.pinTo(1); - - Assert.AreEqual(true, pm.IsData("m1")); - pm.pinTo(1); - - Assert.AreEqual(true, pm.IsData("right")); - pm.pinTo(1); - - Assert.AreEqual(true, pm.IsData(" true")); - } - - /// - ///A test for IsData - /// - [TestMethod()] - public void IsDataTest2() - { - IPM pm = new PM("pname = true"); - - Assert.AreEqual(false, pm.IsData("property1", "property2", "property2", "property3")); - Assert.AreEqual(true, pm.IsData("property1", "property2", "pname", "property3")); - } - - /// - ///A test for getRightOperand - /// - [TestMethod()] - public void getRightOperandTest1() - { - try { - new PM("pname.... = true"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(SyntaxIncorrectException), ex.GetType().ToString()); } - - try { - new PM("pname @ = false"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(SyntaxIncorrectException), ex.GetType().ToString()); } - } - - /// - ///A test for getRightOperand - /// - [TestMethod()] - public void getRightOperandTest2() - { - IPM pm = new PM("pname = true "); - - Assert.AreEqual(true, pm.It(LevelType.Property, "pname")); - Assert.AreEqual(true, pm.IsRight(LevelType.RightOperandStd)); - Assert.AreEqual(" true ", pm.Levels[0].Data); - - pm = new PM("m(): mixed\ndata "); - - Assert.AreEqual(true, pm.It(LevelType.Method, "m")); - Assert.AreEqual(true, pm.IsRight(LevelType.RightOperandColon)); - Assert.AreEqual(" mixed\ndata ", pm.Levels[0].Data); - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/ScriptTest.cs b/vsSolutionBuildEventTest/SBEScripts/ScriptTest.cs deleted file mode 100644 index 8d6d343d..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/ScriptTest.cs +++ /dev/null @@ -1,374 +0,0 @@ -using System; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.Dom; -using net.r_eg.vsSBE.SBEScripts.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.Test.SBEScripts -{ - /// - ///This is a test class for ScriptTest and is intended - ///to contain all ScriptTest Unit Tests - /// - [TestClass()] - public class ScriptTest - { - private static IEnvironment env = new net.r_eg.vsSBE.Environment((EnvDTE80.DTE2)null); - private static IUserVariable uvariable = new UserVariable(); - - /// - /// Use ClassInitialize to run code before running the first test in the class - /// - /// - [ClassInitialize()] - public static void ScriptTestInitialize(TestContext testContext) - { - - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest() - { - IEnvironment env = new net.r_eg.vsSBE.Environment((EnvDTE80.DTE2)null); - Script target = new Script(env, new UserVariable()); - - string expected = "#[( 2 > 1) { #[var name = value] } else { #[var name = value2] }]"; - string actual = target.parse("##[( 2 > 1) { #[var name = value] } else { #[var name = value2] }]"); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for parse - /// - [TestMethod()] - [ExpectedException(typeof(SelectorMismatchException))] - public void parseTest2() - { - Script target = new Script(env, new UserVariable()); - target.parse("#[NotRealComponent prop.Test]"); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest3() - { - Script target = new Script(env, new UserVariable()); - Assert.AreEqual("[( 2 > 1) { body }]", target.parse("[( 2 > 1) { body }]")); - Assert.AreEqual("( 2 > 1) { body }", target.parse("( 2 > 1) { body }")); - Assert.AreEqual(" test ", target.parse(" test ")); - Assert.AreEqual("", target.parse("")); - Assert.AreEqual(" \"test\" ", target.parse(" \"test\" ")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest4() - { - Script target = new Script(env, new UserVariable()); - Assert.AreEqual("B4 ", target.parse("#[(true) {\n #[(1 > 2){ B3 } \n else {B4} ] } else {\n B2 }]")); - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest5() - { - uvariable.unsetAll(); - Script target = new Script(env, uvariable); - - target.parse("#[( 2 < 1) { #[var name = value] } else { #[var name = value2] }]"); - Assert.AreEqual(1, uvariable.Variables.Count()); - foreach(TUserVariable uvar in uvariable.Variables) { - Assert.AreEqual(uvar.ident, "name"); - Assert.AreEqual(uvar.unevaluated, "value2"); - } - } - - /// - ///A test for parse - /// - [TestMethod()] - public void parseTest6() - { - uvariable.unsetAll(); - Script target = new Script(env, uvariable); - - Assert.AreEqual(String.Empty, target.parse("#[\" #[var name = value] \"]")); - Assert.AreEqual(0, uvariable.Variables.Count()); - } - - /// - ///A test for container - /// - [TestMethod()] - public void containerTest1() - { - var uvar = new UserVariable(); - Script target = new Script(env, uvar); - - Assert.AreEqual("ne]", target.parse("#[var name = value\nli]ne]")); - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("value\nli", uvar.get("name")); - } - - /// - ///A test for container - /// - [TestMethod()] - public void containerTest2() - { - var uvar = new UserVariable(); - Script target = new Script(env, uvar); - - Assert.AreEqual(String.Empty, target.parse("#[var name = <#data>value\nli]ne]")); - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("value\nli]ne", uvar.get("name")); - } - - /// - ///A test for container - /// - [TestMethod()] - public void containerTest3() - { - var uvar = new UserVariable(); - Script target = new Script(env, uvar); - - uvar.set("mx", null, "<#data>value\nli]ne"); - uvar.evaluate("mx", null, new EvaluatorBlank(), true); - - Assert.AreEqual(String.Empty, target.parse("#[var name = #[var mx]]")); - Assert.AreEqual(2, uvar.Variables.Count()); - Assert.AreEqual("value\nli]ne", uvar.get("name")); - } - - /// - ///A test for container - /// - [TestMethod()] - public void containerTest4() - { - var uvar = new UserVariable(); - Script target = new Script(env, uvar); - - uvar.set("mx", null, "<#data>value\nli]ne"); - uvar.evaluate("mx", null, new EvaluatorBlank(), true); - - Assert.AreEqual(String.Empty, target.parse("#[var name = <#data>#[var mx]|value\nli]ne]")); - Assert.AreEqual(2, uvar.Variables.Count()); - Assert.AreEqual("value\nli]ne|value\nli]ne", uvar.get("name")); - } - - /// - ///A test for container - /// - [TestMethod()] - public void containerTest5() - { - var uvar = new UserVariable(); - Script target = new Script(env, uvar); - - uvar.set("mx", null, "<#data>value\nli]ne"); - uvar.evaluate("mx", null, new EvaluatorBlank(), true); - - Assert.AreEqual(String.Empty, target.parse("#[var name = #[var mx]]")); - Assert.AreEqual(2, uvar.Variables.Count()); - Assert.AreEqual("value\nli]ne", uvar.get("name")); - } - - /// - ///A test for container - /// - [TestMethod()] - public void containerTest6() - { - var uvar = new UserVariable(); - Script target = new Script(env, uvar); - - Assert.AreEqual(String.Empty, target.parse("#[var name = left [box1] right]")); - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("left [box1] right", uvar.get("name")); - } - - /// - ///A test for container - /// - [TestMethod()] - public void containerTest7() - { - var uvar = new UserVariable(); - Script target = new Script(env, uvar); - - Assert.AreEqual("#[var name = left [box1 right]", target.parse("#[var name = left [box1 right]")); - Assert.AreEqual(0, uvar.Variables.Count()); - - Assert.AreEqual(String.Empty, target.parse("#[var name = \"left [box1 right\"]")); - Assert.AreEqual(1, uvar.Variables.Count()); - Assert.AreEqual("\"left [box1 right\"", uvar.get("name")); - } - - /// - ///A test for container - /// - [TestMethod()] - public void containerTest8() - { - var uvar = new UserVariable(); - Script target = new Script(env, uvar); - - Assert.AreEqual("test - cc", target.parse("#[var sres = <#data>Data1]test - cc#[var sres2 = <#data>Data2]")); - Assert.AreEqual(2, uvar.Variables.Count()); - Assert.AreEqual("Data1", uvar.get("sres")); - Assert.AreEqual("Data2", uvar.get("sres2")); - } - - /// - ///A test for container - /// - [TestMethod()] - public void containerTest9() - { - var uvar = new UserVariable(); - Script target = new Script(env, uvar); - - Assert.AreEqual("test - cc", target.parse("#[var sres = <#data>Data1\n\nEnd]test - cc#[var sres2 = <#data>Data2\n\nEnd]")); - Assert.AreEqual(2, uvar.Variables.Count()); - Assert.AreEqual("Data1\n\nEnd", uvar.get("sres")); - Assert.AreEqual("Data2\n\nEnd", uvar.get("sres2")); - } - - /// - ///A test for parse - unlooping with MSBuild - /// - [TestMethod()] - [ExpectedException(typeof(Exceptions.LimitException))] - public void parseMSBuildUnloopingTest1() - { - var env = new StubEnv(); - var uvar = new UserVariable(); - var msbuild = new vsSBE.MSBuild.Parser(env, uvar); - var sbe = new Script(env, uvar); - - // p4 -> p2 -> p3 -> p1 -> p4 - msbuild.parse(sbe.parse("#[var p1 = $$(p2)]#[var p2 = $$(p1)]#[var p3 = $(p2)]", true)); - } - - /// - ///A test for parse - unlooping with MSBuild - /// - [TestMethod()] - [ExpectedException(typeof(Exceptions.LimitException))] - public void parseMSBuildUnloopingTest2() - { - var env = new StubEnv(); - var uvar = new UserVariable(); - var msbuild = new vsSBE.MSBuild.Parser(env, uvar); - var sbe = new Script(env, uvar); - - msbuild.parse(sbe.parse("#[var p1 = $$(p4)]#[var p2 = $$(p3)]#[var p3 = $$(p1)]#[var p4 = $(p2)]", true)); - } - - /// - ///A test for parse - unlooping with MSBuild - /// - [TestMethod()] - public void parseMSBuildUnloopingTest3() - { - var env = new StubEnv(); - var uvar = new UserVariable(); - var msbuild = new vsSBE.MSBuild.Parser(env, uvar); - var sbe = new Script(env, uvar); - - msbuild.parse(sbe.parse("#[var p2 = $$(p1)]#[var p6 = $$(p2)]#[var p7 = $$(p5)]#[var p5 = $(p6)]", true)); - Assert.IsTrue(true); // no problems for stack & heap - } - - /// - ///A test for parse - unlooping with MSBuild - /// - [TestMethod()] - [ExpectedException(typeof(Exceptions.LimitException))] - public void parseMSBuildUnloopingTest4() - { - var env = new StubEnv(); - var uvar = new UserVariable(); - var msbuild = new vsSBE.MSBuild.Parser(env, uvar); - var sbe = new Script(env, uvar); - - msbuild.parse(sbe.parse("#[var p2 = $$(p1) to $$(p8), and new ($$(p7.Replace('1', '2'))) s$$(p9)]#[var p6 = $$(p2)]#[var p7 = $$(p5)]#[var p5 = $(p6)]", true)); - Assert.IsTrue(true); // no problems for stack & heap - } - - /// - ///A test for parse - unlooping with MSBuild - /// - [TestMethod()] - public void parseMSBuildUnloopingTest5() - { - var env = new StubEnv(); - var uvar = new UserVariable(); - var msbuild = new vsSBE.MSBuild.Parser(env, uvar); - var sbe = new Script(env, uvar); - - msbuild.parse(sbe.parse("#[var test = $$(test)]#[var test = 1 $(test) 2]", true)); - - uvar.unsetAll(); - msbuild.parse(sbe.parse("#[var test = $$(test)]#[var test = 1 $(test.Replace('1', '2')) 2]", true)); - - uvar.unsetAll(); - msbuild.parse(sbe.parse("#[var test = $(test)]#[var test = 1 $(test) 2]", true)); - } - - /// - ///A test for parse - unlooping with MSBuild - /// - [TestMethod()] - public void parseMSBuildUnloopingTest6() - { - var env = new StubEnv(); - var uvar = new UserVariable(); - var msbuild = new vsSBE.MSBuild.Parser(env, uvar); - var sbe = new Script(env, uvar); - - string data = "#[var test = #[($(test) == \""+ vsSBE.MSBuild.Parser.PROP_VALUE_DEFAULT + "\"){0}else{$(test)}]]#[var test]"; - Assert.AreEqual("0", msbuild.parse(sbe.parse(data, true))); - Assert.AreEqual("0", msbuild.parse(sbe.parse(data, true))); - - uvar.set("test", null, "7"); - uvar.evaluate("test", null, new EvaluatorBlank(), true); - Assert.AreEqual("7", msbuild.parse(sbe.parse(data, true))); - } - - /// - ///A test for selector - /// - [TestMethod()] - public void selectorTest1() - { - var target = new Script(new StubEnv(), new UserVariable()); - var dom = new Inspector(target.Bootloader); - - // Compliance Test - entry point to component + CRegex flag - foreach(var c in dom.Root) - { - try { - target.parse(String.Format("#[{0} ]", c.Name)); - } - catch(SelectorMismatchException ex) { - Assert.Fail("`{0}` <- `{1}`", c.Name, ex.Message); - } - catch { } - } - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/StringHandlerTest.cs b/vsSolutionBuildEventTest/SBEScripts/StringHandlerTest.cs deleted file mode 100644 index b2fda0f5..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/StringHandlerTest.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Text.RegularExpressions; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.SBEScripts; - -namespace net.r_eg.vsSBE.Test.SBEScripts -{ - /// - ///This is a test class for StringHandlerTest and is intended - ///to contain all StringHandlerTest Unit Tests - /// - [TestClass()] - public class StringHandlerTest - { - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - /// - ///A test for normalize - /// - [TestMethod()] - public void normalizeTest() - { - Assert.AreEqual("\"test\"", StringHandler.normalize("\\\"test\\\"")); - } - - /// - ///A test for escapeQuotes - /// - [TestMethod()] - public void escapeQuotesTest() - { - Assert.AreEqual(" \\\"test\\\" ", StringHandler.escapeQuotes(" \"test\" ")); - } - - /// - ///A test for normalize - /// - [TestMethod()] - public void normalizeTest2() - { - Assert.AreEqual(String.Empty, StringHandler.normalize(null)); - } - - /// - ///A test for protect - /// - [TestMethod()] - public void protectTest() - { - StringHandler target = new StringHandler(); - string actual = target.protectMixedQuotes("test \"str1\" - 'str2' data"); - Assert.AreEqual(false, Regex.IsMatch(actual, RPattern.DoubleQuotesContent, RegexOptions.IgnorePatternWhitespace)); - Assert.AreEqual(false, Regex.IsMatch(actual, RPattern.SingleQuotesContent, RegexOptions.IgnorePatternWhitespace)); - } - - /// - ///A test for recovery - /// - [TestMethod()] - public void recoveryTest() - { - StringHandler target = new StringHandler(); - string str = target.protectMixedQuotes("test \"str1\" - 'str2' data"); - Assert.AreEqual("test \"str1\" - 'str2' data", target.recovery(str)); - } - } -} diff --git a/vsSolutionBuildEventTest/SBEScripts/ValueTest.cs b/vsSolutionBuildEventTest/SBEScripts/ValueTest.cs deleted file mode 100644 index 900ac9fa..00000000 --- a/vsSolutionBuildEventTest/SBEScripts/ValueTest.cs +++ /dev/null @@ -1,531 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.SBEScripts; -using net.r_eg.vsSBE.SBEScripts.SNode; - -namespace net.r_eg.vsSBE.Test.SBEScripts -{ - /// - ///This is a test class for ValuesTest and is intended - ///to contain all ValuesTest Unit Tests - /// - [TestClass()] - public class ValueTest - { - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - /// - ///A test for toBoolean - /// - [TestMethod()] - public void toBooleanTest() - { - Assert.AreEqual(true, Value.toBoolean("1")); - Assert.AreEqual(true, Value.toBoolean("true")); - Assert.AreEqual(true, Value.toBoolean("TRUE")); - Assert.AreEqual(true, Value.toBoolean("True")); - - Assert.AreEqual(false, Value.toBoolean("0")); - Assert.AreEqual(false, Value.toBoolean("false")); - Assert.AreEqual(false, Value.toBoolean("FALSE")); - Assert.AreEqual(false, Value.toBoolean("False")); - - Assert.AreEqual(true, Value.toBoolean(" 1 ")); - Assert.AreEqual(true, Value.toBoolean(" true ")); - Assert.AreEqual(false, Value.toBoolean(" 0 ")); - Assert.AreEqual(false, Value.toBoolean(" false ")); - } - - /// - ///A test for toBoolean - /// - [TestMethod()] - public void toBooleanTest2() - { - try { - Value.toBoolean("TruE"); - Assert.Fail("1"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectSyntaxException), ex.GetType().ToString()); } - - try { - Value.toBoolean("FalsE"); - Assert.Fail("2"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectSyntaxException), ex.GetType().ToString()); } - - try { - Value.toBoolean("-true"); - Assert.Fail("3"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectSyntaxException), ex.GetType().ToString()); } - - try { - Value.toBoolean("true."); - Assert.Fail("4"); - } - catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectSyntaxException), ex.GetType().ToString()); } - } - - /// - ///A test for toBoolean - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectSyntaxException))] - public void toBooleanTest3() - { - Value.toBoolean(""); - } - - /// - ///A test for from(bool) - /// - [TestMethod()] - public void fromTest() - { - Assert.AreEqual("false", Value.from(false)); - Assert.AreEqual("true", Value.from(true)); - } - - /// - ///A test for cmp === - /// - [TestMethod()] - public void cmpTest() - { - Assert.AreEqual(true, Value.cmp(" test", " test", "===")); - Assert.AreEqual(true, Value.cmp(" tESt ", " tESt ", "===")); - Assert.AreEqual(true, Value.cmp("", "", "===")); - Assert.AreEqual(true, Value.cmp("12", "12", "===")); - Assert.AreEqual(false, Value.cmp("test", " test", "===")); - Assert.AreEqual(false, Value.cmp("test ", " test", "===")); - Assert.AreEqual(false, Value.cmp("tESt", " test", "===")); - Assert.AreEqual(false, Value.cmp(" ", "", "===")); - Assert.AreEqual(false, Value.cmp("12", "12 ", "===")); - } - - /// - ///A test for cmp !== - /// - [TestMethod()] - public void cmpTest2() - { - Assert.AreEqual(false, Value.cmp(" test", " test", "!==")); - Assert.AreEqual(false, Value.cmp(" tESt ", " tESt ", "!==")); - Assert.AreEqual(false, Value.cmp("", "", "!==")); - Assert.AreEqual(false, Value.cmp("12", "12", "!==")); - Assert.AreEqual(true, Value.cmp("test", " test", "!==")); - Assert.AreEqual(true, Value.cmp("test ", " test", "!==")); - Assert.AreEqual(true, Value.cmp("tESt", " test", "!==")); - Assert.AreEqual(true, Value.cmp(" ", "", "!==")); - Assert.AreEqual(true, Value.cmp("12", "12 ", "!==")); - } - - /// - ///A test for cmp ~= - /// - [TestMethod()] - public void cmpTest3() - { - Assert.AreEqual(true, Value.cmp("test-12M-word", "12M", "~=")); - Assert.AreEqual(true, Value.cmp("", "", "~=")); - Assert.AreEqual(true, Value.cmp("test ", " ", "~=")); - Assert.AreEqual(true, Value.cmp(" ", "", "~=")); - Assert.AreEqual(true, Value.cmp("123", "2", "~=")); - Assert.AreEqual(false, Value.cmp("test-12M-word", "12m", "~=")); - Assert.AreEqual(false, Value.cmp("test-12M-word", " ", "~=")); - Assert.AreEqual(false, Value.cmp("test-12M-word", "0", "~=")); - } - - /// - ///A test for cmp == - /// - [TestMethod()] - public void cmpTest4() - { - Assert.AreEqual(true, Value.cmp(" test", " test", "==")); - Assert.AreEqual(true, Value.cmp(" tESt ", " tESt ", "==")); - Assert.AreEqual(true, Value.cmp("", "", "==")); - Assert.AreEqual(true, Value.cmp("12", "12", "==")); - Assert.AreEqual(true, Value.cmp(" 12", "12 ", "==")); - Assert.AreEqual(true, Value.cmp("00012", "12", "==")); - Assert.AreEqual(true, Value.cmp("00012", "012", "==")); - Assert.AreEqual(false, Value.cmp("test", " test", "==")); - Assert.AreEqual(false, Value.cmp("test ", " test", "==")); - Assert.AreEqual(false, Value.cmp("tESt", " test", "==")); - Assert.AreEqual(false, Value.cmp(" ", "", "==")); - Assert.AreEqual(false, Value.cmp("120", "12 ", "==")); - Assert.AreEqual(true, Value.cmp("true", "1", "==")); - Assert.AreEqual(true, Value.cmp("false", "0", "==")); - } - - /// - ///A test for cmp != - /// - [TestMethod()] - public void cmpTest5() - { - Assert.AreEqual(false, Value.cmp(" test", " test", "!=")); - Assert.AreEqual(false, Value.cmp(" tESt ", " tESt ", "!=")); - Assert.AreEqual(false, Value.cmp("", "", "!=")); - Assert.AreEqual(false, Value.cmp("12", "12", "!=")); - Assert.AreEqual(false, Value.cmp(" 12", "12 ", "!=")); - Assert.AreEqual(false, Value.cmp("00012", "12", "!=")); - Assert.AreEqual(false, Value.cmp("00012", "012", "!=")); - Assert.AreEqual(true, Value.cmp("test", " test", "!=")); - Assert.AreEqual(true, Value.cmp("test ", " test", "!=")); - Assert.AreEqual(true, Value.cmp("tESt", " test", "!=")); - Assert.AreEqual(true, Value.cmp(" ", "", "!=")); - Assert.AreEqual(true, Value.cmp("120", "12 ", "!=")); - Assert.AreEqual(false, Value.cmp("true", "1", "!=")); - Assert.AreEqual(false, Value.cmp("false", "0", "!=")); - } - - /// - ///A test for cmp > - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest6() - { - Value.cmp(" test", " test", ">"); - } - - /// - ///A test for cmp > - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest7() - { - Value.cmp("", "", ">"); - } - - /// - ///A test for cmp > - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest8() - { - Value.cmp("t2", "1", ">"); - } - - /// - ///A test for cmp > - /// - [TestMethod()] - public void cmpTest9() - { - Assert.AreEqual(true, Value.cmp("2", "1", ">")); - Assert.AreEqual(true, Value.cmp("2", "01", ">")); - Assert.AreEqual(false, Value.cmp("1", "2", ">")); - Assert.AreEqual(false, Value.cmp("2", "2", ">")); - } - - /// - ///A test for cmp >= - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest10() - { - Value.cmp(" test", " test", ">="); - } - - /// - ///A test for cmp >= - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest11() - { - Value.cmp("", "", ">="); - } - - /// - ///A test for cmp >= - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest12() - { - Value.cmp("t2", "1", ">="); - } - - /// - ///A test for cmp >= - /// - [TestMethod()] - public void cmpTest13() - { - Assert.AreEqual(true, Value.cmp("2", "1", ">=")); - Assert.AreEqual(true, Value.cmp("2", "01", ">=")); - Assert.AreEqual(true, Value.cmp("2", "2", ">=")); - Assert.AreEqual(true, Value.cmp("2", "002", ">=")); - Assert.AreEqual(false, Value.cmp("1", "2", ">=")); - } - - /// - ///A test for cmp < - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest14() - { - Value.cmp(" test", " test", "<"); - } - - /// - ///A test for cmp < - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest15() - { - Value.cmp("", "", "<"); - } - - /// - ///A test for cmp < - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest16() - { - Value.cmp("t2", "1", "<"); - } - - /// - ///A test for cmp < - /// - [TestMethod()] - public void cmpTest17() - { - Assert.AreEqual(false, Value.cmp("2", "1", "<")); - Assert.AreEqual(false, Value.cmp("2", "01", "<")); - Assert.AreEqual(false, Value.cmp("2", "2", "<")); - Assert.AreEqual(true, Value.cmp("1", "2", "<")); - Assert.AreEqual(true, Value.cmp("001", "2", "<")); - } - - /// - ///A test for cmp <= - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest18() - { - Value.cmp(" test", " test", "<="); - } - - /// - ///A test for cmp <= - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest19() - { - Value.cmp("", "", "<="); - } - - /// - ///A test for cmp <= - /// - [TestMethod()] - [ExpectedException(typeof(System.FormatException))] - public void cmpTest20() - { - Value.cmp("t2", "1", "<="); - } - - /// - ///A test for cmp <= - /// - [TestMethod()] - public void cmpTest21() - { - Assert.AreEqual(false, Value.cmp("2", "1", "<=")); - Assert.AreEqual(false, Value.cmp("2", "01", "<=")); - Assert.AreEqual(true, Value.cmp("2", "002", "<=")); - Assert.AreEqual(true, Value.cmp("1", "2", "<=")); - Assert.AreEqual(true, Value.cmp("2", "2", "<=")); - } - - /// - ///A test for cmp <= - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectSyntaxException))] - public void cmpTest22() - { - Value.cmp("2", "1", "test"); - } - - /// - ///A test for cmp <= - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectSyntaxException))] - public void cmpTest23() - { - Value.cmp("2", "1", ""); - } - - /// - ///A test for cmp <= - /// - [TestMethod()] - [ExpectedException(typeof(IncorrectSyntaxException))] - public void cmpTest24() - { - Value.cmp("2", "1", "> ="); - } - - /// - ///A test for pack - /// - [TestMethod()] - public void packTest1() - { - object data = (object)new object[] { "str", 123, -1.4, true, "str2", new object[] { 1.2f, "str2", false }, -24.574 }; - Assert.AreEqual("{\"str\", 123, -1.4, true, \"str2\", {1.2f, \"str2\", false}, -24.574}", Value.pack(data)); - } - - /// - ///A test for pack - /// - [TestMethod()] - public void packTest2() - { - object data = (object)new object[] { "str", 't', new object[] { 'a', 'b', 'c' }, true }; - Assert.AreEqual("{\"str\", 't', {'a', 'b', 'c'}, true}", Value.pack(data)); - } - - /// - ///A test for pack - /// - [TestMethod()] - public void packTest3() - { - Assert.AreEqual(" test ", Value.pack(" test ")); - Assert.AreEqual(String.Empty, Value.pack(String.Empty)); - Assert.AreEqual(null, Value.pack(null)); - } - - /// - ///A test for pack and SNode.Arguments - Optional compatibility - /// - [TestMethod()] - public void packTest4() - { - object data = (object)new object[] { "str", 123, -1.4, true, 'n', new object[] { 1.2f, "str2", 'y', false }, -24.574 }; - - IPM pm = new PM(String.Format("left({0})", Value.pack(data))); - - Argument[] raw = (Argument[])pm.Levels[0].Args; - Assert.AreEqual(raw.Length, 1); - - Assert.AreEqual(raw[0].type, ArgumentType.Object); - { - Argument[] args = (Argument[])raw[0].data; - Assert.AreEqual(args.Length, 7); - - Assert.AreEqual(args[0].type, ArgumentType.StringDouble); - Assert.AreEqual(args[0].data, "str"); - - Assert.AreEqual(args[1].type, ArgumentType.Integer); - Assert.AreEqual(args[1].data, 123); - - Assert.AreEqual(args[2].type, ArgumentType.Double); - Assert.AreEqual(args[2].data, -1.4); - - Assert.AreEqual(args[3].type, ArgumentType.Boolean); - Assert.AreEqual(args[3].data, true); - - Assert.AreEqual(args[4].type, ArgumentType.Char); - Assert.AreEqual(args[4].data, 'n'); - - Assert.AreEqual(args[5].type, ArgumentType.Object); - { - Argument[] args5 = (Argument[])args[5].data; - Assert.AreEqual(args5.Length, 4); - - Assert.AreEqual(args5[0].type, ArgumentType.Float); - Assert.AreEqual(args5[0].data, 1.2f); - - Assert.AreEqual(args5[1].type, ArgumentType.StringDouble); - Assert.AreEqual(args5[1].data, "str2"); - - Assert.AreEqual(args5[2].type, ArgumentType.Char); - Assert.AreEqual(args5[2].data, 'y'); - - Assert.AreEqual(args5[3].type, ArgumentType.Boolean); - Assert.AreEqual(args5[3].data, false); - } - - Assert.AreEqual(args[6].type, ArgumentType.Double); - Assert.AreEqual(args[6].data, -24.574); - } - } - - /// - ///A test for pack and SNode.Arguments /Float and Double - Optional compatibility - /// - [TestMethod()] - public void packTest5() - { - object data = (object)new object[] { 1.4, 1.4f, 1.4d, -1.4, -1.4f, -1.4d }; - - IPM pm = new PM(String.Format("left({0})", Value.pack(data))); - - Argument[] args = (Argument[])pm.Levels[0].Args[0].data; - Assert.AreEqual(args.Length, 6); - - Assert.AreEqual(args[0].type, ArgumentType.Double); - Assert.AreEqual(args[0].data, 1.4d); - - Assert.AreEqual(args[1].type, ArgumentType.Float); - Assert.AreEqual(args[1].data, 1.4f); - - Assert.AreEqual(args[2].type, ArgumentType.Double); - Assert.AreEqual(args[2].data, 1.4d); - - Assert.AreEqual(args[3].type, ArgumentType.Double); - Assert.AreEqual(args[3].data, -1.4d); - - Assert.AreEqual(args[4].type, ArgumentType.Float); - Assert.AreEqual(args[4].data, -1.4f); - - Assert.AreEqual(args[5].type, ArgumentType.Double); - Assert.AreEqual(args[5].data, -1.4d); - } - - /// - ///A test for pack - nested - /// - [TestMethod()] - public void packTest6() - { - object data = (object)new object[] { "str", new object[] { 1, 'y', new object[] { -12.457f, new object[] { 12 } } }, true }; - Assert.AreEqual("{\"str\", {1, 'y', {-12.457f, {12}}}, true}", Value.pack(data)); - } - } -} diff --git a/vsSolutionBuildEventTest/Scripts/UserVariableTest.cs b/vsSolutionBuildEventTest/Scripts/UserVariableTest.cs deleted file mode 100644 index 77930d57..00000000 --- a/vsSolutionBuildEventTest/Scripts/UserVariableTest.cs +++ /dev/null @@ -1,451 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using net.r_eg.vsSBE.Exceptions; -using net.r_eg.vsSBE.Scripts; - -namespace net.r_eg.vsSBE.Test.Scripts -{ - /// - ///This is a test class for UserVariableTest and is intended - ///to contain all UserVariableTest Unit Tests - /// - [TestClass()] - public class UserVariableTest - { - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - /// - ///A test for Definitions - /// - [TestMethod()] - public void DefinitionsTest() - { - UserVariable target = new UserVariable(); - Assert.AreEqual(target.Definitions.Count(), 0); - } - - /// - ///A test for Variables - /// - [TestMethod()] - public void VariablesTest() - { - UserVariable target = new UserVariable(); - Assert.AreEqual(target.Variables.Count(), 0); - } - - /// - ///A test for set - /// - [TestMethod()] - public void setTest() - { - UserVariable target = new UserVariable(); - target.set("name", null, "unevaluated"); - - Assert.AreEqual(1, target.Definitions.Count()); - foreach(string v in target.Definitions) { - Assert.AreEqual(v, "name"); - } - } - - /// - ///A test for set - /// - [TestMethod()] - public void setTest2() - { - UserVariableAccessor target = new UserVariableAccessor(); - string name = "name"; - string project = "project"; - target.set(name, project, "unevaluated"); - - Assert.AreEqual(1, target.Definitions.Count()); - foreach(string v in target.Definitions) { - Assert.AreEqual(v, target.defIndex(name, project)); - } - } - - /// - ///A test for set - /// - [TestMethod()] - public void setTest3() - { - UserVariable target = new UserVariable(); - target.set("name", null, "unevaluated"); - Assert.AreEqual(1, target.Variables.Count()); - - foreach(TUserVariable v in target.Variables) { - Assert.AreEqual(v.evaluated, null); - Assert.AreEqual(v.ident, "name"); - Assert.AreEqual(v.persistence, false); - Assert.AreEqual(v.prev, new TUserVariable()); - Assert.AreEqual(v.status, TUserVariable.StatusType.Unevaluated); - Assert.AreEqual(v.unevaluated, "unevaluated"); - } - } - - /// - ///A test for set - /// - [TestMethod()] - public void setTest4() - { - UserVariableAccessor target = new UserVariableAccessor(); - string name = "name"; - string project = "project"; - target.set(name, project, "unevaluated"); - Assert.AreEqual(1, target.Variables.Count()); - - foreach(TUserVariable v in target.Variables) { - Assert.AreEqual(v.evaluated, null); - Assert.AreEqual(v.ident, target.defIndex(name, project)); - Assert.AreEqual(v.persistence, false); - Assert.AreEqual(v.prev, new TUserVariable()); - Assert.AreEqual(v.status, TUserVariable.StatusType.Unevaluated); - Assert.AreEqual(v.unevaluated, "unevaluated"); - } - } - - /// - ///A test for set - /// - [TestMethod()] - [ExpectedException(typeof(InvalidArgumentException))] - public void setTest5() - { - UserVariable target = new UserVariable(); - target.set("na%me", "project", "unevaluated"); - } - - /// - ///A test for set - /// - [TestMethod()] - public void setTest6() - { - UserVariable target = new UserVariable(); - target.set("name", "project", null); - - Assert.AreEqual(1, target.Variables.Count()); - foreach(TUserVariable v in target.Variables) { - Assert.AreEqual(v.unevaluated, String.Empty); - } - } - - /// - ///A test for unsetAll - /// - [TestMethod()] - public void unsetAllTest() - { - UserVariable target = new UserVariable(); - target.set("name", null, "unevaluated"); - target.unsetAll(); - Assert.AreEqual(target.Variables.Count(), 0); - } - - /// - ///A test for unset - /// - [TestMethod()] - public void unsetTest() - { - UserVariable target = new UserVariable(); - target.set("name", null, "unevaluated"); - target.set("name2", null, "unevaluated2"); - - target.unset("name", null); - Assert.AreEqual(1, target.Definitions.Count()); - - foreach(string v in target.Definitions) { - Assert.AreEqual(v, "name2"); - } - } - - /// - ///A test for unset - /// - [TestMethod()] - public void unsetTest3() - { - UserVariable target = new UserVariable(); - target.set("name", null, "unevaluated"); - target.set("name2", null, "unevaluated2"); - - target.unset("name"); - Assert.AreEqual(1, target.Definitions.Count()); - - foreach(string v in target.Definitions) { - Assert.AreEqual(v, "name2"); - } - } - - /// - ///A test for isValidName - /// - [TestMethod()] - public void isValidNameTest() - { - UserVariable target = new UserVariable(); - Assert.AreEqual(true, target.isValidName("name")); - Assert.AreEqual(true, target.isValidName("n")); - Assert.AreEqual(true, target.isValidName("name0")); - Assert.AreEqual(true, target.isValidName("name_n")); - Assert.AreEqual(false, target.isValidName("0name")); - Assert.AreEqual(false, target.isValidName("")); - Assert.AreEqual(false, target.isValidName("na%me")); - Assert.AreEqual(false, target.isValidName("name ")); - } - - /// - ///A test for isUnevaluated - /// - [TestMethod()] - [ExpectedException(typeof(KeyNotFoundException))] - public void isUnevaluatedTest() - { - UserVariable target = new UserVariable(); - target.isUnevaluated("name", "project"); - } - - /// - ///A test for isUnevaluated - /// - [TestMethod()] - [ExpectedException(typeof(KeyNotFoundException))] - public void isUnevaluatedTest2() - { - UserVariable target = new UserVariable(); - target.isUnevaluated("name"); - } - - /// - ///A test for isUnevaluated - /// - [TestMethod()] - public void isUnevaluatedTest3() - { - UserVariable target = new UserVariable(); - target.set("name", null, "val"); - Assert.AreEqual(true, target.isUnevaluated("name")); - } - - /// - ///A test for isUnevaluated - /// - [TestMethod()] - public void isUnevaluatedTest4() - { - UserVariable target = new UserVariable(); - target.set("name", "project", "val"); - Assert.AreEqual(true, target.isUnevaluated("name", "project")); - } - - /// - ///A test for isExist - /// - [TestMethod()] - public void isExistTest() - { - UserVariable target = new UserVariable(); - Assert.AreEqual(false, target.isExist("name", "project")); - } - - /// - ///A test for isExist - /// - [TestMethod()] - public void isExistTest2() - { - UserVariable target = new UserVariable(); - Assert.AreEqual(false, target.isExist("name")); - } - - /// - ///A test for isExist - /// - [TestMethod()] - public void isExistTest3() - { - UserVariable target = new UserVariable(); - target.set("name", "project", "val"); - Assert.AreEqual(true, target.isExist("name", "project")); - } - - /// - ///A test for isExist - /// - [TestMethod()] - public void isExistTest4() - { - UserVariableAccessor target = new UserVariableAccessor(); - string name = "name"; - string project = "project"; - target.set(name, project, "val"); - Assert.AreEqual(true, target.isExist(target.defIndex(name, project))); - } - - /// - ///A test for get - /// - [TestMethod()] - public void getTest() - { - UserVariable target = new UserVariable(); - Assert.AreEqual(null, target.get("name")); - Assert.AreEqual(null, target.get("name", "project")); - } - - /// - ///A test for get - /// - [TestMethod()] - public void getTest2() - { - UserVariableAccessor target = new UserVariableAccessor(); - string name = "name"; - string project = "project"; - target.set(name, project, "val"); - Assert.AreEqual(String.Empty, target.get(target.defIndex(name, project))); - } - - /// - ///A test for get - /// - [TestMethod()] - public void getTest3() - { - UserVariable target = new UserVariable(); - target.set("name", null, "val"); - Assert.AreEqual(String.Empty, target.get("name")); - } - - /// - ///A test for evaluate - /// - [TestMethod()] - [ExpectedException(typeof(NotFoundException))] - public void evaluateTest() - { - UserVariable target = new UserVariable(); - target.evaluate("name", "project", new Evaluator1(), true); - } - - /// - ///A test for evaluate - /// - [TestMethod()] - [ExpectedException(typeof(NotFoundException))] - public void evaluateTest2() - { - UserVariable target = new UserVariable(); - target.evaluate("name", new Evaluator1(), true); - } - - /// - ///A test for evaluate - /// - [TestMethod()] - [ExpectedException(typeof(InvalidArgumentException))] - public void evaluateTest3() - { - UserVariable target = new UserVariable(); - string name = "name"; - string project = "project"; - - target.set(name, project, "val"); - target.evaluate(name, project, null, true); - } - - /// - ///A test for evaluate - /// - [TestMethod()] - public void evaluateTest4() - { - UserVariable target = new UserVariable(); - string name = "name"; - string project = "project"; - - target.set(name, project, "val"); - target.evaluate(name, project, new Evaluator1(), true); - Assert.AreEqual("[E1:val]", target.get(name, project)); - } - - /// - ///A test for evaluate - /// - [TestMethod()] - public void evaluateTest5() - { - UserVariable target = new UserVariable(); - string name = "name"; - string project = "project"; - - target.set(name, project, "val"); - target.evaluate(name, project, new Evaluator1(), true); - target.evaluate(name, project, new Evaluator2(), false); - Assert.AreEqual("[E2:[E1:val]]", target.get(name, project)); - } - - /// - ///A test for evaluate - /// - [TestMethod()] - public void evaluateTest6() - { - UserVariable target = new UserVariable(); - string name = "name"; - string project = "project"; - - target.set(name, project, "val"); - target.evaluate(name, project, new Evaluator1(), true); - target.evaluate(name, project, new Evaluator2(), true); - Assert.AreEqual("[E2:val]", target.get(name, project)); - } - - private class UserVariableAccessor: UserVariable - { - public new string defIndex(string name, string project) - { - return base.defIndex(name, project); - } - } - - private class Evaluator1: IEvaluator - { - public string evaluate(string data) - { - return String.Format("[E1:{0}]", data); - } - } - - private class Evaluator2: IEvaluator - { - public string evaluate(string data) - { - return String.Format("[E2:{0}]", data); - } - } - } -} diff --git a/vsSolutionBuildEventTest/SobaAcs.cs b/vsSolutionBuildEventTest/SobaAcs.cs new file mode 100644 index 00000000..54e4b3cb --- /dev/null +++ b/vsSolutionBuildEventTest/SobaAcs.cs @@ -0,0 +1,20 @@ +using net.r_eg.SobaScript; +using net.r_eg.Varhead; + +namespace net.r_eg.vsSBE.Test +{ + internal static class SobaAcs + { + public static ISobaScript MakeNew() + => MakeNew(new StubEnv()); + + public static ISobaScript MakeNew(IEnvironment env) + => Bootloader.Configure(new Soba(), env); + + public static ISobaScript MakeNew(IUVars uvars) + => MakeNew(uvars, new StubEnv()); + + public static ISobaScript MakeNew(IUVars uvars, IEnvironment env) + => Bootloader.Configure(new Soba(uvars), env); + } +} diff --git a/vsSolutionBuildEventTest/SobaScript/Components/InternalComponentTest.cs b/vsSolutionBuildEventTest/SobaScript/Components/InternalComponentTest.cs new file mode 100644 index 00000000..3f5e75ae --- /dev/null +++ b/vsSolutionBuildEventTest/SobaScript/Components/InternalComponentTest.cs @@ -0,0 +1,271 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using net.r_eg.SobaScript; +using net.r_eg.SobaScript.Exceptions; +using net.r_eg.Varhead; +using net.r_eg.vsSBE.Events; +using net.r_eg.vsSBE.SobaScript.Components; + +namespace net.r_eg.vsSBE.Test.SobaScript.Components +{ + [TestClass] + public class InternalComponentTest + { + private IEnvironment env = new StubEnv(); + private IUVars uvariable = new UVars(); + + [TestMethod] + public void eventsItemRunTest1() + { + var target = new InternalComponentAccessor(); + + try { + target.Eval("[Core events.Pre.item(1).run]"); + Assert.Fail("1"); + } + catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(IncorrectNodeException), ex.GetType().ToString()); } + + try { + target.Eval("[Core events.Pre.item(1).run() = true]"); + Assert.Fail("2"); + } + catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } + + try { + target.Eval("[Core events.Pre.item(1).run(): true]"); + Assert.Fail("3"); + } + catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } + + try { + target.Eval("[Core events.Pre.item(1).run().m]"); + Assert.Fail("4"); + } + catch(Exception ex) { Assert.IsTrue(ex.GetType() == typeof(NotSupportedOperationException), ex.GetType().ToString()); } + } + + [TestMethod] + public void eventsItemRunTest2() + { + var target = new InternalComponentAccessor(); + Assert.AreEqual(Value.From(true), target.Eval("[Core events.Pre.item(1).run()]")); + Assert.AreEqual(Value.From(true), target.Eval("[Core events.Pre.item(1).run(Common)]")); + Assert.AreEqual(Value.From(false), target.Eval("[Core events.Pre.item(2).run()]")); + Assert.AreEqual(Value.From(false), target.Eval("[Core events.Pre.item(3).run()]")); + Assert.AreEqual(Value.From(false), target.Eval("[Core events.Pre.item(3).run(Common)]")); + Assert.AreEqual(Value.From(true), target.Eval("[Core events.Pre.item(3).run(Rebuild)]")); + } + + [TestMethod] + [ExpectedException(typeof(IncorrectSyntaxException))] + public void parseTest() + { + InternalComponent target = new InternalComponent(new Soba(uvariable), new StubEnv()); + target.Eval("#[vsSBE events.Type.item(1)]"); + } + + [TestMethod] + [ExpectedException(typeof(IncorrectSyntaxException))] + public void parseTest2() + { + InternalComponent target = new InternalComponent(new Soba(uvariable), new StubEnv()); + target.Eval("vsSBE events.Type.item(1)"); + } + + [TestMethod] + [ExpectedException(typeof(SubtypeNotFoundException))] + public void parseTest3() + { + InternalComponent target = new InternalComponent(new Soba(uvariable), new StubEnv()); + target.Eval("[vsSBE NoExist.Type]"); + } + + [TestMethod] + [ExpectedException(typeof(OperandNotFoundException))] + public void stEventsParseTest1() + { + InternalComponent target = new InternalComponent(new Soba(uvariable), new StubEnv()); + target.Eval("[vsSBE events.Type.item(name)]"); + } + + [TestMethod()] + [ExpectedException(typeof(OperandNotFoundException))] + public void stEventsParseTest2() + { + InternalComponent target = new InternalComponent(new Soba(uvariable), new StubEnv()); + target.Eval("[vsSBE events.Type.item(1).test]"); + } + + [TestMethod()] + public void pEnabledParseTest1() + { + InternalComponentAccessor target = new InternalComponentAccessor(); + Assert.AreEqual(Value.From(true), target.Eval("[vsSBE events.Pre.item(1).Enabled]")); + Assert.AreEqual(Value.From(true), target.Eval("[vsSBE events.Pre.item(\"Name1\").Enabled]")); + Assert.AreEqual(Value.From(false), target.Eval("[vsSBE events.Pre.item(2).Enabled]")); + Assert.AreEqual(Value.From(false), target.Eval("[vsSBE events.Pre.item(\"Name2\").Enabled]")); + } + + [TestMethod()] + [ExpectedException(typeof(IncorrectSyntaxException))] + public void pEnabledParseTest2() + { + InternalComponentAccessor target = new InternalComponentAccessor(); + target.Eval("[vsSBE events.Pre.item(1).Enabled = 1true]"); + } + + [TestMethod()] + public void pEnabledParseTest3() + { + InternalComponentAccessor target = new InternalComponentAccessor(); + Assert.AreEqual(Value.From(true), target.Eval("[vsSBE events.Pre.item(1).Enabled]")); + Assert.AreEqual(Value.Empty, target.Eval("[vsSBE events.Pre.item(1).Enabled = false]")); + Assert.AreEqual(Value.From(false), target.Eval("[vsSBE events.Pre.item(1).Enabled]")); + + Assert.AreEqual(Value.From(false), target.Eval("[vsSBE events.Pre.item(\"Name2\").Enabled]")); + Assert.AreEqual(Value.Empty, target.Eval("[vsSBE events.Pre.item(\"Name2\").Enabled = true]")); + Assert.AreEqual(Value.From(true), target.Eval("[vsSBE events.Pre.item(\"Name2\").Enabled]")); + } + + [TestMethod()] + [ExpectedException(typeof(IncorrectNodeException))] + public void pStatusParseTest1() + { + InternalComponentAccessor target = new InternalComponentAccessor(); + target.Eval("[vsSBE events.Pre.item(1).Status.Has Errors]"); + } + + [TestMethod()] + public void pStatusParseTest2() + { + InternalComponentAccessor target = new InternalComponentAccessor(); + Assert.AreEqual("false", target.Eval("[vsSBE events.Pre.item(1).Status.HasErrors]")); + } + + [TestMethod()] + [ExpectedException(typeof(IncorrectNodeException))] + public void pStatusParseTest3() + { + InternalComponentAccessor target = new InternalComponentAccessor(); + target.Eval("[vsSBE events.Pre.item(1).Status.NotExistProp]"); + } + + [TestMethod] + [ExpectedException(typeof(IncorrectNodeException))] + public void startUpProjectTest1() + { + var target = new InternalComponent(new Soba(uvariable), new StubEnv()); + target.Eval("[Core StartUpProject: test]"); + } + + [TestMethod] + public void startUpProjectTest2() + { + IEnvironment env = new StubEnv(); + var target = new InternalComponent(new Soba(), env); + string defProject = env.StartupProjectString; + + Assert.AreEqual(env.StartupProjectString, target.Eval("[Core StartUpProject]")); + + Assert.AreEqual(String.Empty, target.Eval("[Core StartUpProject = project1]")); + Assert.AreEqual("project1", env.StartupProjectString); + Assert.AreEqual(env.StartupProjectString, target.Eval("[Core StartUpProject]")); + + Assert.AreEqual(String.Empty, target.Eval("[Core StartUpProject = \"project2\"]")); + Assert.AreEqual("project2", env.StartupProjectString); + Assert.AreEqual(env.StartupProjectString, target.Eval("[Core StartUpProject]")); + + Assert.AreEqual(String.Empty, target.Eval("[Core StartUpProject = \"\"]")); + Assert.AreEqual(defProject, env.StartupProjectString); + Assert.AreEqual(env.StartupProjectString, target.Eval("[Core StartUpProject]")); + } + + [TestMethod] + public void startUpProjectTest3() + { + IEnvironment env = new StubEnv(); + var target = new InternalComponent(new Soba(), env); + string defProject = env.StartupProjectString; + + Assert.AreEqual(String.Empty, target.Eval("[Core StartUpProject = project1]")); + Assert.AreEqual("project1", env.StartupProjectString); + Assert.AreEqual(env.StartupProjectString, target.Eval("[Core StartUpProject]")); + + Assert.AreEqual(String.Empty, target.Eval("[Core StartUpProject =]")); + Assert.AreEqual(defProject, env.StartupProjectString); + Assert.AreEqual(env.StartupProjectString, target.Eval("[Core StartUpProject]")); + } + + [TestMethod()] + [ExpectedException(typeof(IncorrectNodeException))] + public void pStdoutTest1() + { + var target = new InternalComponentAccessor(); + target.Eval("[Core events.Pre.item(1).stdout = true]"); + } + + [TestMethod()] + public void pStdoutTest2() + { + var target = new InternalComponentAccessor(); + Assert.AreNotEqual(null, target.Eval("[Core events.Pre.item(1).stdout]")); + } + + [TestMethod()] + [ExpectedException(typeof(IncorrectNodeException))] + public void pStderrTest1() + { + var target = new InternalComponentAccessor(); + target.Eval("[Core events.Pre.item(1).stderr = true]"); + } + + [TestMethod()] + public void pStderrTest2() + { + var target = new InternalComponentAccessor(); + Assert.AreNotEqual(null, target.Eval("[Core events.Pre.item(1).stderr]")); + } + + private class InternalComponentAccessor: InternalComponent + { + private SBEEvent[] evt = null; + + public InternalComponentAccessor() + : base(new Soba(), new StubEnv()) + { + + } + + protected override ISolutionEvent[] getEvent(SolutionEventType type) + { + if(evt != null) { + return evt; + } + + evt = new SBEEvent[3]{ + new SBEEvent(){ + Name = "Name1", + SupportMSBuild = false, + SupportSBEScripts = false, + Mode = new ModeFile() { Command = "" }, + Enabled = true + }, + new SBEEvent(){ + Name = "Name2", + Mode = new ModeFile() { Command = "" }, + Enabled = false + }, + new SBEEvent(){ + Name = "Name3", + SupportMSBuild = false, + SupportSBEScripts = false, + BuildType = Bridge.BuildType.Rebuild, + Mode = new ModeFile() { Command = "" }, + Enabled = true + } + }; + return evt; + } + } + } +} diff --git a/vsSolutionBuildEventTest/TempFile.cs b/vsSolutionBuildEventTest/TempFile.cs index 4ec109d4..c665b540 100644 --- a/vsSolutionBuildEventTest/TempFile.cs +++ b/vsSolutionBuildEventTest/TempFile.cs @@ -3,7 +3,7 @@ namespace net.r_eg.vsSBE.Test { - public sealed class TempFile: IDisposable + internal sealed class TempFile: IDisposable { public string dir { diff --git a/vsSolutionBuildEventTest/key.snk b/vsSolutionBuildEventTest/key.snk new file mode 100644 index 0000000000000000000000000000000000000000..d22fd8e2b2ff325cd6d58f5a3bbcf6c672de0803 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50098SOSLl@_dKvRgLwZ=Un~4NM@Pkug@lvv z-&s2E;ObHCZXKe<3Kf*Ly90Rtg^Gu$F49PQAZl@s7s5;>Gqz=Vs$WvnE6>m)GvM1k zH5OW*3Hrd9pH6recj>+geAd6_ed46W($uh&`k?ZMn5!%#{S*RUfQ`}v7iL>p*6b6xHjE!h7}M!iZ6 zPvR&-l{w1=<11(w&0dp$kiTa0$6uzA`MFuI7c8!gu$CdKSuzz9{5W8*11@cM+=5z( zloh+;v}_!ceAV%uajMrwUaNhi5A+s_#@g#lo6z%C@{U3Cb~DQ;og#vI^{C*!{bxtD zJ+Rq@rustMKfBd%JOlmwK`ZOAq9h+B0=QT7xC7C^Qk6e|{rc-{foF&Y|A;o#O^pc# zT4hwWAv6X}=w^lsRJANn>E@&!LWf!f!yovNM&LkUl`%7VniMZhzf8wx&!M<=$5}Bo z=UQ?9kuP>GB<`Ka^z4s`oGGm2ubfM|T1ytfR{ud`WnoRT__Ez{0e|{ZxOh^V$XinD iT_(gtXy!N~e6&k=j3!o5obBU&s!Y)CcYXACSkf`*pC&2* literal 0 HcmV?d00001 diff --git a/vsSolutionBuildEventTest/packages.config b/vsSolutionBuildEventTest/packages.config index 120d023c..3f52a326 100644 --- a/vsSolutionBuildEventTest/packages.config +++ b/vsSolutionBuildEventTest/packages.config @@ -1,5 +1,6 @@  + diff --git a/vsSolutionBuildEventTest/vsSolutionBuildEventTest.csproj b/vsSolutionBuildEventTest/vsSolutionBuildEventTest.csproj index dd105136..63212780 100644 --- a/vsSolutionBuildEventTest/vsSolutionBuildEventTest.csproj +++ b/vsSolutionBuildEventTest/vsSolutionBuildEventTest.csproj @@ -37,6 +37,7 @@ false + true bin\Release\ true pdbonly @@ -45,6 +46,7 @@ MinimumRecommendedRules.ruleset + true true bin\Debug\ DEBUG;TRACE @@ -53,6 +55,15 @@ prompt MinimumRecommendedRules.ruleset + + true + + + false + + + key.snk + ..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll @@ -67,7 +78,6 @@ ..\packages\vsSBE.SDK.$(vsSBE_SDK)\lib\net45\EnvDTE80.dll True - ..\packages\Moq.4.12.0\lib\net45\Moq.dll @@ -87,15 +97,52 @@ + + + + + + ..\packages\Microsoft.Build.16.0.461\lib\net472\Microsoft.Build.Framework.dll + True + + + + + + + + + + + + {73919171-44b6-4536-b892-f1fca653887c} Bridge + + {e51d1ea3-f4a7-4f27-a941-e16d2b88d08a} + E-MSBuild + TargetFramework=net40 + TargetFramework=netstandard2.0 + + + {4670b9b4-1ba9-4cb2-bbfc-ec4ebeb40a42} + Varhead + TargetFramework=net40 + TargetFramework=netstandard2.0 + {F905DFB2-2E67-4FF7-9001-924F6F2D645D} MvsSln + + {3a80b650-b457-4de4-b2d3-64191a20c6b7} + SobaScript + TargetFramework=net40 + TargetFramework=netstandard2.0 + {32E44995-F621-4E77-B46A-8F65D64E7FEA} vsSolutionBuildEvent @@ -108,36 +155,18 @@ - - - - - - + - - - - - - - + - - - - - - - - +