Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 9 commits
  • 3,380 files changed
  • 0 comments
  • 1 contributor
May 06, 2012
andoridhacker check in cutoolsnet 5b76ace
andoridhacker CLAP command line library 8f42e66
andoridhacker Json library 7ad60bf
andoridhacker log4net c586d65
andoridhacker Update project: wave2text f1a37bb
andoridhacker update vs proj c3c208b
andoridhacker support command line reco 688ede9
andoridhacker note file 935181c
andoridhacker update notes.txt 2796a7e

Showing 3,380 changed files with 105,301 additions and 0 deletions. Show diff stats Hide diff stats

  1. +8 0 Libs/CLAP/.gitignore
  2. +91 0 Libs/CLAP/CLAP.sln
  3. +155 0 Libs/CLAP/CLAP/CLAP.csproj
  4. +20 0 Libs/CLAP/CLAP/CollectionValidationAttribute.cs
  5. +1 0  Libs/CLAP/CLAP/CoverageExcludeAttribute.cs
  6. +16 0 Libs/CLAP/CLAP/DefaultProvider.cs
  7. +14 0 Libs/CLAP/CLAP/EmptyAttribute.cs
  8. +33 0 Libs/CLAP/CLAP/EnvironmentParserHandlers.cs
  9. +14 0 Libs/CLAP/CLAP/ErrorAttribute.cs
  10. +16 0 Libs/CLAP/CLAP/ExceptionContext.cs
  11. +485 0 Libs/CLAP/CLAP/Exceptions.cs
  12. +336 0 Libs/CLAP/CLAP/FW2Stuff.cs
  13. +36 0 Libs/CLAP/CLAP/FileSystemHelper.cs
  14. +42 0 Libs/CLAP/CLAP/GlobalAttribute.cs
  15. +35 0 Libs/CLAP/CLAP/HelpAttribute.cs
  16. +238 0 Libs/CLAP/CLAP/HelpGenerator.cs
  17. +46 0 Libs/CLAP/CLAP/HelpInfo.cs
  18. +28 0 Libs/CLAP/CLAP/IValidation.cs
  19. +26 0 Libs/CLAP/CLAP/Interception/IVerbInterceptor.cs
  20. +25 0 Libs/CLAP/CLAP/Interception/ParameterAndValue.cs
  21. +13 0 Libs/CLAP/CLAP/Interception/PostVerbExecutionAttribute.cs
  22. +50 0 Libs/CLAP/CLAP/Interception/PostVerbExecutionContext.cs
  23. +13 0 Libs/CLAP/CLAP/Interception/PreVerbExecutionAttribute.cs
  24. +32 0 Libs/CLAP/CLAP/Interception/PreVerbExecutionContext.cs
  25. +41 0 Libs/CLAP/CLAP/Interception/UserVerbExecutionContext.cs
  26. +28 0 Libs/CLAP/CLAP/Interception/VerbInterception.cs
  27. +65 0 Libs/CLAP/CLAP/Method.cs
  28. +38 0 Libs/CLAP/CLAP/MethodInvoker.cs
  29. +278 0 Libs/CLAP/CLAP/MultiParser.cs
  30. +23 0 Libs/CLAP/CLAP/Pair.cs
  31. +99 0 Libs/CLAP/CLAP/Parameter.cs
  32. +139 0 Libs/CLAP/CLAP/ParameterAttribute.cs
  33. +63 0 Libs/CLAP/CLAP/ParametersExpressionValidator.cs
  34. +240 0 Libs/CLAP/CLAP/Parser.Console.cs
  35. +240 0 Libs/CLAP/CLAP/Parser.WinForms.cs
  36. +413 0 Libs/CLAP/CLAP/Parser.cs
  37. +340 0 Libs/CLAP/CLAP/ParserRegistration.cs
  38. +1,063 0 Libs/CLAP/CLAP/ParserRunner.cs
  39. +33 0 Libs/CLAP/CLAP/Properties/AssemblyInfo.cs
  40. +13 0 Libs/CLAP/CLAP/Publish/CLAP.nuspec
  41. BIN  Libs/CLAP/CLAP/Publish/GetVer.exe
  42. BIN  Libs/CLAP/CLAP/Publish/ILMerge.exe
  43. BIN  Libs/CLAP/CLAP/Publish/fart.exe
  44. +33 0 Libs/CLAP/CLAP/Publish/pack.cmd
  45. +50 0 Libs/CLAP/CLAP/Serialization.cs
  46. +137 0 Libs/CLAP/CLAP/TypeValidator.cs
  47. +167 0 Libs/CLAP/CLAP/Utils.cs
  48. +56 0 Libs/CLAP/CLAP/Validation/DirectoryExistsAttribute.cs
  49. +65 0 Libs/CLAP/CLAP/Validation/FileExistsAttribute.cs
  50. +64 0 Libs/CLAP/CLAP/Validation/Less.cs
  51. +64 0 Libs/CLAP/CLAP/Validation/LessOrEqual.cs
  52. +65 0 Libs/CLAP/CLAP/Validation/More.cs
  53. +65 0 Libs/CLAP/CLAP/Validation/MoreOrEqual.cs
  54. +45 0 Libs/CLAP/CLAP/Validation/NumberValidator.cs
  55. +56 0 Libs/CLAP/CLAP/Validation/PathExistsAttribute.cs
  56. +72 0 Libs/CLAP/CLAP/Validation/Regex.cs
  57. +65 0 Libs/CLAP/CLAP/Validation/ValidateAttribute.cs
  58. +32 0 Libs/CLAP/CLAP/ValidationAttribute.cs
  59. +34 0 Libs/CLAP/CLAP/ValueInfo.cs
  60. +259 0 Libs/CLAP/CLAP/ValuesFactory.cs
  61. +27 0 Libs/CLAP/CLAP/VerbAttribute.cs
  62. +36 0 Libs/CLAP/CLAP/VerbExecutionContext.cs
  63. +4 0 Libs/CLAP/CLAP/packages.config
  64. +98 0 Libs/CLAP/ConsoleTest/ConsoleTest.csproj
  65. +804 0 Libs/CLAP/ConsoleTest/Program.cs
  66. +35 0 Libs/CLAP/ConsoleTest/Properties/AssemblyInfo.cs
  67. +3 0  Libs/CLAP/ConsoleTest/app.config
  68. +139 0 Libs/CLAP/README.md
  69. +625 0 Libs/CLAP/Tests/MultiParserTests.cs
  70. +34 0 Libs/CLAP/Tests/Properties/AssemblyInfo.cs
  71. +1,472 0 Libs/CLAP/Tests/Samples.cs
  72. +15 0 Libs/CLAP/Tests/StaticSamples.cs
  73. +2,530 0 Libs/CLAP/Tests/Tests.cs
  74. +147 0 Libs/CLAP/Tests/Tests.csproj
  75. +34 0 Libs/CLAP/Tests/UtilsTests.cs
  76. +5 0 Libs/CLAP/Tests/packages.config
  77. +39 0 Libs/CLAP/WinFormTest/Form1.Designer.cs
  78. +19 0 Libs/CLAP/WinFormTest/Form1.cs
  79. +36 0 Libs/CLAP/WinFormTest/Program.cs
  80. +36 0 Libs/CLAP/WinFormTest/Properties/AssemblyInfo.cs
  81. +71 0 Libs/CLAP/WinFormTest/Properties/Resources.Designer.cs
  82. +117 0 Libs/CLAP/WinFormTest/Properties/Resources.resx
  83. +30 0 Libs/CLAP/WinFormTest/Properties/Settings.Designer.cs
  84. +7 0 Libs/CLAP/WinFormTest/Properties/Settings.settings
  85. +90 0 Libs/CLAP/WinFormTest/WinFormTest.csproj
  86. +39 0 Libs/CLAP/packages/Moq.4.0.10827/License.txt
  87. BIN  Libs/CLAP/packages/Moq.4.0.10827/Moq.chm
  88. BIN  Libs/CLAP/packages/Moq.4.0.10827/lib/NET35/Moq.dll
  89. BIN  Libs/CLAP/packages/Moq.4.0.10827/lib/NET35/Moq.pdb
  90. +5,768 0 Libs/CLAP/packages/Moq.4.0.10827/lib/NET35/Moq.xml
  91. BIN  Libs/CLAP/packages/Moq.4.0.10827/lib/NET40/Moq.dll
  92. BIN  Libs/CLAP/packages/Moq.4.0.10827/lib/NET40/Moq.pdb
  93. +5,120 0 Libs/CLAP/packages/Moq.4.0.10827/lib/NET40/Moq.xml
  94. BIN  Libs/CLAP/packages/Moq.4.0.10827/lib/Silverlight4/Castle.Core.dll
  95. BIN  Libs/CLAP/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.dll
  96. BIN  Libs/CLAP/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.pdb
  97. +5,101 0 Libs/CLAP/packages/Moq.4.0.10827/lib/Silverlight4/Moq.Silverlight.xml
  98. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/Logo.ico
  99. +277 0 Libs/CLAP/packages/NUnit.2.5.10.11092/NUnitFitTests.html
  100. +342 0 Libs/CLAP/packages/NUnit.2.5.10.11092/fit-license.txt
  101. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/lib/nunit.framework.dll
  102. +10,407 0 Libs/CLAP/packages/NUnit.2.5.10.11092/lib/nunit.framework.xml
  103. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/lib/nunit.mocks.dll
  104. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/lib/pnunit.framework.dll
  105. +15 0 Libs/CLAP/packages/NUnit.2.5.10.11092/license.txt
  106. +124 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/NUnitTests.VisualState.xml
  107. +85 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/NUnitTests.config
  108. +14 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/NUnitTests.nunit
  109. +5,971 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/TestResult.xml
  110. +4 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/agent.conf
  111. +18 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/agent.log.conf
  112. +18 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/launcher.log.conf
  113. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/Failure.png
  114. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/Ignored.png
  115. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/Inconclusive.png
  116. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/Skipped.png
  117. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/Success.png
  118. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/fit.dll
  119. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/log4net.dll
  120. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/nunit-console-runner.dll
  121. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/nunit-gui-runner.dll
  122. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/nunit.core.dll
  123. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/nunit.core.interfaces.dll
  124. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/nunit.fixtures.dll
  125. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/nunit.uiexception.dll
  126. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/nunit.uikit.dll
  127. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/lib/nunit.util.dll
  128. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit-agent-x86.exe
  129. +69 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit-agent-x86.exe.config
  130. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit-agent.exe
  131. +69 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit-agent.exe.config
  132. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit-console-x86.exe
  133. +69 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit-console-x86.exe.config
  134. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit-console.exe
  135. +69 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit-console.exe.config
  136. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit-x86.exe
  137. +83 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit-x86.exe.config
  138. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit.exe
  139. +83 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit.exe.config
  140. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/nunit.framework.dll
  141. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/pnunit-agent.exe
  142. +77 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/pnunit-agent.exe.config
  143. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/pnunit-launcher.exe
  144. +77 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/pnunit-launcher.exe.config
  145. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/pnunit.framework.dll
  146. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/pnunit.tests.dll
  147. BIN  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/runFile.exe
  148. +43 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/runFile.exe.config
  149. +2 0  Libs/CLAP/packages/NUnit.2.5.10.11092/tools/runpnunit.bat
  150. +24 0 Libs/CLAP/packages/NUnit.2.5.10.11092/tools/test.conf
  151. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/net20/Newtonsoft.Json.dll
  152. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/net20/Newtonsoft.Json.pdb
  153. +7,722 0 Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/net20/Newtonsoft.Json.xml
  154. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/net35/Newtonsoft.Json.dll
  155. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/net35/Newtonsoft.Json.pdb
  156. +6,845 0 Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/net35/Newtonsoft.Json.xml
  157. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/net40/Newtonsoft.Json.dll
  158. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/net40/Newtonsoft.Json.pdb
  159. +7,004 0 Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/net40/Newtonsoft.Json.xml
  160. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/sl3-wp/Newtonsoft.Json.dll
  161. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/sl3-wp/Newtonsoft.Json.pdb
  162. +6,437 0 Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/sl3-wp/Newtonsoft.Json.xml
  163. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/sl4-windowsphone71/Newtonsoft.Json.dll
  164. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/sl4-windowsphone71/Newtonsoft.Json.pdb
  165. +6,437 0 Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/sl4-windowsphone71/Newtonsoft.Json.xml
  166. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/sl4/Newtonsoft.Json.dll
  167. BIN  Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/sl4/Newtonsoft.Json.pdb
  168. +6,467 0 Libs/CLAP/packages/Newtonsoft.Json.4.0.8/lib/sl4/Newtonsoft.Json.xml
  169. +5 0 Libs/CLAP/packages/repositories.config
  170. +51 0 Libs/Newtonsoft.Json/.gitattributes
  171. +7 0 Libs/Newtonsoft.Json/.gitignore
  172. +14 0 Libs/Newtonsoft.Json/Build/Newtonsoft.Json.nuspec
  173. +201 0 Libs/Newtonsoft.Json/Build/build.ps1
  174. +2 0  Libs/Newtonsoft.Json/Build/runbuild.cmd
  175. +5 0 Libs/Newtonsoft.Json/Build/runbuild.ps1
  176. +92 0 Libs/Newtonsoft.Json/Doc/ContractResolver.html
  177. +146 0 Libs/Newtonsoft.Json/Doc/ConvertingJSONandXML.html
  178. +99 0 Libs/Newtonsoft.Json/Doc/CustomCreationConverter.html
  179. +106 0 Libs/Newtonsoft.Json/Doc/DatesInJSON.html
  180. +68 0 Libs/Newtonsoft.Json/Doc/Introduction.html
  181. +254 0 Libs/Newtonsoft.Json/Doc/LINQtoJSON.html
  182. +138 0 Libs/Newtonsoft.Json/Doc/PreserveObjectReferences.html
  183. +87 0 Libs/Newtonsoft.Json/Doc/ReadingWritingJSON.html
  184. +280 0 Libs/Newtonsoft.Json/Doc/ReducingSerializedJSONSize.html
  185. +116 0 Libs/Newtonsoft.Json/Doc/SelectToken.html
  186. +133 0 Libs/Newtonsoft.Json/Doc/SerializationAttributes.html
  187. +143 0 Libs/Newtonsoft.Json/Doc/SerializationCallbacks.html
  188. +172 0 Libs/Newtonsoft.Json/Doc/SerializationErrorHandling.html
  189. +344 0 Libs/Newtonsoft.Json/Doc/SerializationGuide.html
  190. +513 0 Libs/Newtonsoft.Json/Doc/SerializationSettings.html
  191. +128 0 Libs/Newtonsoft.Json/Doc/SerializingCollections.html
  192. +103 0 Libs/Newtonsoft.Json/Doc/SerializingJSON.html
  193. +125 0 Libs/Newtonsoft.Json/Doc/SerializingJSONFragments.html
  194. +19 0 Libs/Newtonsoft.Json/Doc/custom.css
  195. +90 0 Libs/Newtonsoft.Json/Doc/doc.shfbproj
  196. +23 0 Libs/Newtonsoft.Json/Doc/doc.sitemap
  197. BIN  Libs/Newtonsoft.Json/Doc/donate.gif
  198. +85 0 Libs/Newtonsoft.Json/Doc/readme.txt
  199. +439 0 Libs/Newtonsoft.Json/Doc/styles.css
  200. +32 0 Libs/Newtonsoft.Json/Doc/versions.txt
  201. BIN  Libs/Newtonsoft.Json/Src/Lib/NUnit/Compact/NUnitLite.dll
  202. BIN  Libs/Newtonsoft.Json/Src/Lib/NUnit/DotNet/nunit.framework.dll
  203. +5,521 0 Libs/Newtonsoft.Json/Src/Lib/NUnit/DotNet/nunit.framework.xml
  204. BIN  Libs/Newtonsoft.Json/Src/Lib/NUnit/Silverlight/nunit.framework.dll
  205. +64 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Metro.sln
  206. +32 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Net20.sln
  207. +26 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Net35.sln
  208. +32 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Portable.sln
  209. +31 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Silverlight.sln
  210. +1,317 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs
  211. +684 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs
  212. +193 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/BinaryConverterTests.cs
  213. +260 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/CustomCreationConverterTests.cs
  214. +408 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/DataSetConverterTests.cs
  215. +238 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/DataTableConverterTests.cs
  216. +190 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/ExpandoObjectConverterTests.cs
  217. +272 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/IsoDateTimeConverterTests.cs
  218. +248 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/JavaScriptDateTimeConverterTests.cs
  219. +85 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/ObjectIdConverterTests.cs
  220. +186 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/RegexConverterTests.cs
  221. +325 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/StringEnumConverterTests.cs
  222. +117 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/VersionConverterTests.cs
  223. +1,860 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Converters/XmlNodeConverterTest.cs
  224. +101 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/ExceptionTests.cs
  225. +524 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/FileSystemEntityModel.Designer.cs
  226. +184 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/FileSystemEntityModel.edmx
  227. BIN  Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Images/UnitTestLogo.png
  228. BIN  Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Images/UnitTestSmallLogo.png
  229. BIN  Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Images/UnitTestSplashScreen.png
  230. BIN  Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Images/UnitTestStoreLogo.png
  231. +79 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/JsonArrayAttributeTests.cs
  232. +753 0 Libs/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs
Sorry, we could not display the entire diff because too many files (3,380) changed.
8 Libs/CLAP/.gitignore
... ... @@ -0,0 +1,8 @@
  1 +*.docstates
  2 +*.suo
  3 +*.user
  4 +bin
  5 +obj
  6 +UpgradeLog.XML
  7 +_UpgradeReport_Files/
  8 +*.nupkg
91 Libs/CLAP/CLAP.sln
... ... @@ -0,0 +1,91 @@
  1 +
  2 +Microsoft Visual Studio Solution File, Format Version 11.00
  3 +# Visual Studio 2010
  4 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CLAP", "CLAP\CLAP.csproj", "{AE79CD7B-DFFC-4156-913E-63F70A31B7C1}"
  5 +EndProject
  6 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTest", "ConsoleTest\ConsoleTest.csproj", "{678F4788-6950-4FE2-B471-99AB9E5B4BE9}"
  7 +EndProject
  8 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{63D887CB-655A-4FA1-A8B8-38A28613A707}"
  9 +EndProject
  10 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormTest", "WinFormTest\WinFormTest.csproj", "{20D947B0-A9E4-480B-A24C-5D8621D4A59B}"
  11 +EndProject
  12 +Global
  13 + GlobalSection(SolutionConfigurationPlatforms) = preSolution
  14 + Debug|Any CPU = Debug|Any CPU
  15 + Debug|Mixed Platforms = Debug|Mixed Platforms
  16 + Debug|x86 = Debug|x86
  17 + Release|Any CPU = Release|Any CPU
  18 + Release|Mixed Platforms = Release|Mixed Platforms
  19 + Release|x86 = Release|x86
  20 + Release20|Any CPU = Release20|Any CPU
  21 + Release20|Mixed Platforms = Release20|Mixed Platforms
  22 + Release20|x86 = Release20|x86
  23 + EndGlobalSection
  24 + GlobalSection(ProjectConfigurationPlatforms) = postSolution
  25 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
  26 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
  27 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
  28 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
  29 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Debug|x86.ActiveCfg = Debug|Any CPU
  30 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
  31 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Release|Any CPU.Build.0 = Release|Any CPU
  32 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
  33 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
  34 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Release|x86.ActiveCfg = Release|Any CPU
  35 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Release20|Any CPU.ActiveCfg = Release20|Any CPU
  36 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Release20|Any CPU.Build.0 = Release20|Any CPU
  37 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Release20|Mixed Platforms.ActiveCfg = Release20|Any CPU
  38 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Release20|Mixed Platforms.Build.0 = Release20|Any CPU
  39 + {AE79CD7B-DFFC-4156-913E-63F70A31B7C1}.Release20|x86.ActiveCfg = Release20|Any CPU
  40 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Debug|Any CPU.ActiveCfg = Debug|x86
  41 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Debug|Any CPU.Build.0 = Debug|x86
  42 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
  43 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Debug|Mixed Platforms.Build.0 = Debug|x86
  44 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Debug|x86.ActiveCfg = Debug|x86
  45 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Debug|x86.Build.0 = Debug|x86
  46 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Release|Any CPU.ActiveCfg = Release|x86
  47 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Release|Mixed Platforms.ActiveCfg = Release|x86
  48 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Release|Mixed Platforms.Build.0 = Release|x86
  49 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Release|x86.ActiveCfg = Release|x86
  50 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Release|x86.Build.0 = Release|x86
  51 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Release20|Any CPU.ActiveCfg = Release20|x86
  52 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Release20|Any CPU.Build.0 = Release20|x86
  53 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Release20|Mixed Platforms.ActiveCfg = Release20|x86
  54 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Release20|Mixed Platforms.Build.0 = Release20|x86
  55 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Release20|x86.ActiveCfg = Release20|x86
  56 + {678F4788-6950-4FE2-B471-99AB9E5B4BE9}.Release20|x86.Build.0 = Release20|x86
  57 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
  58 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Debug|Any CPU.Build.0 = Debug|Any CPU
  59 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
  60 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
  61 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Debug|x86.ActiveCfg = Debug|Any CPU
  62 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Release|Any CPU.ActiveCfg = Release|Any CPU
  63 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Release|Any CPU.Build.0 = Release|Any CPU
  64 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
  65 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Release|Mixed Platforms.Build.0 = Release|Any CPU
  66 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Release|x86.ActiveCfg = Release|Any CPU
  67 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Release20|Any CPU.ActiveCfg = Release20|Any CPU
  68 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Release20|Any CPU.Build.0 = Release20|Any CPU
  69 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Release20|Mixed Platforms.ActiveCfg = Release20|Any CPU
  70 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Release20|Mixed Platforms.Build.0 = Release20|Any CPU
  71 + {63D887CB-655A-4FA1-A8B8-38A28613A707}.Release20|x86.ActiveCfg = Release20|Any CPU
  72 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Debug|Any CPU.ActiveCfg = Debug|x86
  73 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
  74 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Debug|Mixed Platforms.Build.0 = Debug|x86
  75 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Debug|x86.ActiveCfg = Debug|x86
  76 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Debug|x86.Build.0 = Debug|x86
  77 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Release|Any CPU.ActiveCfg = Release|x86
  78 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Release|Mixed Platforms.ActiveCfg = Release|x86
  79 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Release|Mixed Platforms.Build.0 = Release|x86
  80 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Release|x86.ActiveCfg = Release|x86
  81 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Release|x86.Build.0 = Release|x86
  82 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Release20|Any CPU.ActiveCfg = Release|x86
  83 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Release20|Mixed Platforms.ActiveCfg = Release|x86
  84 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Release20|Mixed Platforms.Build.0 = Release|x86
  85 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Release20|x86.ActiveCfg = Release|x86
  86 + {20D947B0-A9E4-480B-A24C-5D8621D4A59B}.Release20|x86.Build.0 = Release|x86
  87 + EndGlobalSection
  88 + GlobalSection(SolutionProperties) = preSolution
  89 + HideSolutionNode = FALSE
  90 + EndGlobalSection
  91 +EndGlobal
155 Libs/CLAP/CLAP/CLAP.csproj
... ... @@ -0,0 +1,155 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3 + <PropertyGroup>
  4 + <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
  5 + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  6 + <ProductVersion>8.0.30703</ProductVersion>
  7 + <SchemaVersion>2.0</SchemaVersion>
  8 + <ProjectGuid>{AE79CD7B-DFFC-4156-913E-63F70A31B7C1}</ProjectGuid>
  9 + <OutputType>Library</OutputType>
  10 + <AppDesignerFolder>Properties</AppDesignerFolder>
  11 + <RootNamespace>CLAP</RootNamespace>
  12 + <AssemblyName>CLAP</AssemblyName>
  13 + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
  14 + <FileAlignment>512</FileAlignment>
  15 + <TargetFrameworkProfile>Client</TargetFrameworkProfile>
  16 + <PublishUrl>publish\</PublishUrl>
  17 + <Install>true</Install>
  18 + <InstallFrom>Disk</InstallFrom>
  19 + <UpdateEnabled>false</UpdateEnabled>
  20 + <UpdateMode>Foreground</UpdateMode>
  21 + <UpdateInterval>7</UpdateInterval>
  22 + <UpdateIntervalUnits>Days</UpdateIntervalUnits>
  23 + <UpdatePeriodically>false</UpdatePeriodically>
  24 + <UpdateRequired>false</UpdateRequired>
  25 + <MapFileExtensions>true</MapFileExtensions>
  26 + <ApplicationRevision>0</ApplicationRevision>
  27 + <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
  28 + <IsWebBootstrapper>false</IsWebBootstrapper>
  29 + <UseApplicationTrust>false</UseApplicationTrust>
  30 + <BootstrapperEnabled>true</BootstrapperEnabled>
  31 + </PropertyGroup>
  32 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  33 + <DebugSymbols>true</DebugSymbols>
  34 + <DebugType>full</DebugType>
  35 + <Optimize>false</Optimize>
  36 + <OutputPath>bin\Debug\</OutputPath>
  37 + <DefineConstants>DEBUG;TRACE</DefineConstants>
  38 + <ErrorReport>prompt</ErrorReport>
  39 + <WarningLevel>4</WarningLevel>
  40 + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
  41 + <DocumentationFile>bin\Debug\CLAP.XML</DocumentationFile>
  42 + <NoWarn>1591</NoWarn>
  43 + </PropertyGroup>
  44 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  45 + <DebugType>pdbonly</DebugType>
  46 + <Optimize>true</Optimize>
  47 + <OutputPath>bin\Release\</OutputPath>
  48 + <DefineConstants>TRACE</DefineConstants>
  49 + <ErrorReport>prompt</ErrorReport>
  50 + <WarningLevel>4</WarningLevel>
  51 + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
  52 + <DocumentationFile>bin\Release\CLAP.XML</DocumentationFile>
  53 + <NoWarn>1591</NoWarn>
  54 + </PropertyGroup>
  55 + <PropertyGroup>
  56 + <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
  57 + </PropertyGroup>
  58 + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release20|AnyCPU'">
  59 + <OutputPath>bin\Release20\</OutputPath>
  60 + <DefineConstants>TRACE;FW2</DefineConstants>
  61 + <DocumentationFile>bin\Release20\CLAP.XML</DocumentationFile>
  62 + <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
  63 + <Optimize>true</Optimize>
  64 + <NoWarn>1591</NoWarn>
  65 + <DebugType>pdbonly</DebugType>
  66 + <PlatformTarget>AnyCPU</PlatformTarget>
  67 + <CodeAnalysisLogFile>bin\Release20\CLAP.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
  68 + <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
  69 + <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
  70 + <ErrorReport>prompt</ErrorReport>
  71 + </PropertyGroup>
  72 + <ItemGroup>
  73 + <Reference Condition="'$(Configuration)' != 'Release20'" Include="Newtonsoft.Json, Version=4.0.8.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
  74 + <HintPath>..\packages\Newtonsoft.Json.4.0.8\lib\net35\Newtonsoft.Json.dll</HintPath>
  75 + </Reference>
  76 + <Reference Condition="'$(Configuration)' == 'Release20'" Include="Newtonsoft.Json, Version=4.0.8.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
  77 + <HintPath>..\packages\Newtonsoft.Json.4.0.8\lib\net20\Newtonsoft.Json.dll</HintPath>
  78 + </Reference>
  79 + <Reference Include="System" />
  80 + <Reference Include="System.Data" />
  81 + <Reference Include="System.Windows.Forms" />
  82 + <Reference Include="System.Xml" />
  83 + </ItemGroup>
  84 + <ItemGroup>
  85 + <Compile Include="CollectionValidationAttribute.cs" />
  86 + <Compile Include="DefaultProvider.cs" />
  87 + <Compile Include="HelpInfo.cs" />
  88 + <Compile Include="Interception\UserVerbExecutionContext.cs" />
  89 + <Compile Include="Pair.cs" />
  90 + <Compile Include="Parser.WinForms.cs" />
  91 + <Compile Include="EnvironmentParserHandlers.cs" />
  92 + <Compile Include="Parser.Console.cs" />
  93 + <Compile Include="CoverageExcludeAttribute.cs" />
  94 + <Compile Include="ErrorAttribute.cs" />
  95 + <Compile Include="ExceptionContext.cs" />
  96 + <Compile Include="FileSystemHelper.cs" />
  97 + <Compile Include="FW2Stuff.cs" />
  98 + <Compile Include="EmptyAttribute.cs" />
  99 + <Compile Include="Exceptions.cs" />
  100 + <Compile Include="GlobalAttribute.cs" />
  101 + <Compile Include="HelpGenerator.cs" />
  102 + <Compile Include="Interception\IVerbInterceptor.cs" />
  103 + <Compile Include="Interception\PostVerbExecutionAttribute.cs" />
  104 + <Compile Include="Interception\PostVerbExecutionContext.cs" />
  105 + <Compile Include="Interception\ParameterAndValue.cs" />
  106 + <Compile Include="Interception\PreVerbExecutionAttribute.cs" />
  107 + <Compile Include="Interception\PreVerbExecutionContext.cs" />
  108 + <Compile Include="VerbExecutionContext.cs" />
  109 + <Compile Include="Interception\VerbInterception.cs" />
  110 + <Compile Include="Method.cs" />
  111 + <Compile Include="MethodInvoker.cs" />
  112 + <Compile Include="MultiParser.cs" />
  113 + <Compile Include="Parameter.cs" />
  114 + <Compile Include="ParameterAttribute.cs" />
  115 + <Compile Include="ParametersExpressionValidator.cs" />
  116 + <Compile Include="Parser.cs" />
  117 + <Compile Include="IValidation.cs" />
  118 + <Compile Include="ParserRunner.cs" />
  119 + <Compile Include="ParserRegistration.cs" />
  120 + <Compile Include="Properties\AssemblyInfo.cs" />
  121 + <Compile Include="Serialization.cs" />
  122 + <Compile Include="TypeValidator.cs" />
  123 + <Compile Include="Utils.cs" />
  124 + <Compile Include="ValidationAttribute.cs" />
  125 + <Compile Include="HelpAttribute.cs" />
  126 + <Compile Include="Validation\PathExistsAttribute.cs" />
  127 + <Compile Include="Validation\DirectoryExistsAttribute.cs" />
  128 + <Compile Include="Validation\FileExistsAttribute.cs" />
  129 + <Compile Include="Validation\Less.cs" />
  130 + <Compile Include="Validation\LessOrEqual.cs" />
  131 + <Compile Include="Validation\More.cs" />
  132 + <Compile Include="Validation\MoreOrEqual.cs" />
  133 + <Compile Include="Validation\NumberValidator.cs" />
  134 + <Compile Include="Validation\Regex.cs" />
  135 + <Compile Include="Validation\ValidateAttribute.cs" />
  136 + <Compile Include="ValueInfo.cs" />
  137 + <Compile Include="ValuesFactory.cs" />
  138 + <Compile Include="VerbAttribute.cs" />
  139 + </ItemGroup>
  140 + <ItemGroup>
  141 + <None Include="packages.config" />
  142 + </ItemGroup>
  143 + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  144 + <PropertyGroup>
  145 + <PostBuildEvent>
  146 + </PostBuildEvent>
  147 + </PropertyGroup>
  148 + <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  149 + Other similar extension points exist, see Microsoft.Common.targets.
  150 + <Target Name="BeforeBuild">
  151 + </Target>
  152 + <Target Name="AfterBuild">
  153 + </Target>
  154 + -->
  155 +</Project>
20 Libs/CLAP/CLAP/CollectionValidationAttribute.cs
... ... @@ -0,0 +1,20 @@
  1 +using System;
  2 +
  3 +namespace CLAP
  4 +{
  5 + /// <summary>
  6 + /// Validates a collection of parameters of properties
  7 + /// </summary>
  8 + public abstract class CollectionValidationAttribute : Attribute, ICollectionValidation
  9 + {
  10 + /// <summary>
  11 + /// Gets a validator instance
  12 + /// </summary>
  13 + public abstract ICollectionValidator GetValidator();
  14 +
  15 + /// <summary>
  16 + /// The validation description
  17 + /// </summary>
  18 + public abstract string Description { get; }
  19 + }
  20 +}
1  Libs/CLAP/CLAP/CoverageExcludeAttribute.cs
... ... @@ -0,0 +1 @@
  1 +internal class CoverageExcludeAttribute : System.Attribute { }
16 Libs/CLAP/CLAP/DefaultProvider.cs
... ... @@ -0,0 +1,16 @@
  1 +
  2 +namespace CLAP
  3 +{
  4 + public abstract class DefaultProvider
  5 + {
  6 + public abstract object GetDefault(VerbExecutionContext context);
  7 +
  8 + public virtual string Description
  9 + {
  10 + get
  11 + {
  12 + return GetType().Name;
  13 + }
  14 + }
  15 + }
  16 +}
14 Libs/CLAP/CLAP/EmptyAttribute.cs
... ... @@ -0,0 +1,14 @@
  1 +using System;
  2 +
  3 +namespace CLAP
  4 +{
  5 + /// <summary>
  6 + /// Marks a method to be executed when there is no input.
  7 + /// The method must not accept any parameter except if marked along with [Help].
  8 + /// </summary>
  9 + [Serializable]
  10 + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
  11 + public sealed class EmptyAttribute : Attribute
  12 + {
  13 + }
  14 +}
33 Libs/CLAP/CLAP/EnvironmentParserHandlers.cs
... ... @@ -0,0 +1,33 @@
  1 +using System;
  2 +using System.Diagnostics;
  3 +using System.Windows.Forms;
  4 +
  5 +namespace CLAP
  6 +{
  7 + internal static class EnvironmentParserHandlers
  8 + {
  9 + internal static MultiParser Console(this MultiParser parser)
  10 + {
  11 + parser.Register.HelpHandler("help,h,?", help => System.Console.WriteLine(help));
  12 + parser.Register.EmptyHelpHandler(help => System.Console.WriteLine(help));
  13 + parser.Register.ParameterHandler("debug", () => Debugger.Launch());
  14 + parser.Register.ErrorHandler(c =>
  15 + {
  16 + System.Console.ForegroundColor = ConsoleColor.White;
  17 + System.Console.WriteLine(c.Exception.Message);
  18 + System.Console.ResetColor();
  19 + });
  20 +
  21 + return parser;
  22 + }
  23 +
  24 + internal static MultiParser WinForms(this MultiParser parser)
  25 + {
  26 + parser.Register.HelpHandler("help,h,?", help => MessageBox.Show(help));
  27 + parser.Register.ParameterHandler("debug", () => Debugger.Launch());
  28 + parser.Register.ErrorHandler(c => MessageBox.Show(c.Exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error));
  29 +
  30 + return parser;
  31 + }
  32 + }
  33 +}
14 Libs/CLAP/CLAP/ErrorAttribute.cs
... ... @@ -0,0 +1,14 @@
  1 +using System;
  2 +
  3 +namespace CLAP
  4 +{
  5 + /// <summary>
  6 + /// Marks a method to be executed when an exception occurs.
  7 + /// The method may only accept one parameter of type CLAP.ExceptionContext
  8 + /// </summary>
  9 + [Serializable]
  10 + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
  11 + public sealed class ErrorAttribute : Attribute
  12 + {
  13 + }
  14 +}
16 Libs/CLAP/CLAP/ExceptionContext.cs
... ... @@ -0,0 +1,16 @@
  1 +using System;
  2 +
  3 +namespace CLAP
  4 +{
  5 + public sealed class ExceptionContext
  6 + {
  7 + public Exception Exception { get; private set; }
  8 +
  9 + public bool ReThrow { get; set; }
  10 +
  11 + internal ExceptionContext(Exception ex)
  12 + {
  13 + Exception = ex;
  14 + }
  15 + }
  16 +}
485 Libs/CLAP/CLAP/Exceptions.cs
... ... @@ -0,0 +1,485 @@
  1 +using System;
  2 +using System.Collections.Generic;
  3 +using System.Reflection;
  4 +
  5 +namespace CLAP
  6 +{
  7 + /// <summary>
  8 + /// Base exception class for all parser exceptions
  9 + /// </summary>
  10 + [Serializable]
  11 + public abstract class CommandLineParserException : Exception
  12 + {
  13 + /// <summary>
  14 + /// Constructor
  15 + /// </summary>
  16 + public CommandLineParserException() { }
  17 +
  18 + /// <summary>
  19 + /// Constructor
  20 + /// </summary>
  21 + public CommandLineParserException(string message) : base(message) { }
  22 +
  23 + /// <summary>
  24 + /// Constructor
  25 + /// </summary>
  26 + public CommandLineParserException(string message, Exception inner) : base(message, inner) { }
  27 +
  28 + protected CommandLineParserException(
  29 + System.Runtime.Serialization.SerializationInfo info,
  30 + System.Runtime.Serialization.StreamingContext context)
  31 + : base(info, context) { }
  32 + }
  33 +
  34 + [Serializable]
  35 + public class MissingDefaultVerbException : CommandLineParserException
  36 + {
  37 + public MissingDefaultVerbException()
  38 + : this("No default verb was found")
  39 + {
  40 + }
  41 + public MissingDefaultVerbException(string message) : base(message) { }
  42 + public MissingDefaultVerbException(string message, Exception inner) : base(message, inner) { }
  43 + protected MissingDefaultVerbException(
  44 + System.Runtime.Serialization.SerializationInfo info,
  45 + System.Runtime.Serialization.StreamingContext context)
  46 + : base(info, context) { }
  47 + }
  48 +
  49 + [Serializable]
  50 + public class VerbNotFoundException : CommandLineParserException
  51 + {
  52 + /// <summary>
  53 + /// The verb string that wasn't found
  54 + /// </summary>
  55 + public string Verb { get; private set; }
  56 +
  57 + public VerbNotFoundException(string verb)
  58 + : base("Verb '{0}' was not found".FormatWith(verb))
  59 + {
  60 + Verb = verb;
  61 + }
  62 +
  63 + public VerbNotFoundException(string message, Exception inner) : base(message, inner) { }
  64 + protected VerbNotFoundException(
  65 + System.Runtime.Serialization.SerializationInfo info,
  66 + System.Runtime.Serialization.StreamingContext context)
  67 + : base(info, context) { }
  68 + }
  69 +
  70 + [Serializable]
  71 + public class MissingVerbException : CommandLineParserException
  72 + {
  73 + public MissingVerbException()
  74 + : this("Arguments contain no verb", null)
  75 + {
  76 + }
  77 +
  78 + public MissingVerbException(string message, Exception inner) : base(message, inner) { }
  79 + protected MissingVerbException(
  80 + System.Runtime.Serialization.SerializationInfo info,
  81 + System.Runtime.Serialization.StreamingContext context)
  82 + : base(info, context) { }
  83 + }
  84 +
  85 + [Serializable]
  86 + public class MultiParserMissingClassNameException : CommandLineParserException
  87 + {
  88 + public MultiParserMissingClassNameException()
  89 + : this("Arguments contain no class name nor verb", null)
  90 + {
  91 + }
  92 +
  93 + public MultiParserMissingClassNameException(string message, Exception inner) : base(message, inner) { }
  94 + protected MultiParserMissingClassNameException(
  95 + System.Runtime.Serialization.SerializationInfo info,
  96 + System.Runtime.Serialization.StreamingContext context)
  97 + : base(info, context) { }
  98 + }
  99 +
  100 + [Serializable]
  101 + public class InvalidVerbException : CommandLineParserException
  102 + {
  103 + public InvalidVerbException()
  104 + : this("Invalid verb", null)
  105 + {
  106 + }
  107 +
  108 + public InvalidVerbException(string message, Exception inner) : base(message, inner) { }
  109 + protected InvalidVerbException(
  110 + System.Runtime.Serialization.SerializationInfo info,
  111 + System.Runtime.Serialization.StreamingContext context)
  112 + : base(info, context) { }
  113 + }
  114 +
  115 + [Serializable]
  116 + public class UnknownParserTypeException : CommandLineParserException
  117 + {
  118 + public UnknownParserTypeException(string typeName)
  119 + : this("Parser type '{0}' not found".FormatWith(typeName), null)
  120 + {
  121 + }
  122 +
  123 + public UnknownParserTypeException(string message, Exception inner) : base(message, inner) { }
  124 + protected UnknownParserTypeException(
  125 + System.Runtime.Serialization.SerializationInfo info,
  126 + System.Runtime.Serialization.StreamingContext context)
  127 + : base(info, context) { }
  128 + }
  129 +
  130 + [Serializable]
  131 + public class MissingRequiredArgumentException : CommandLineParserException
  132 + {
  133 + /// <summary>
  134 + /// The name of the required parameter
  135 + /// </summary>
  136 + public string ParameterName { get; private set; }
  137 +
  138 + /// <summary>
  139 + /// The verb that requires the parameter
  140 + /// </summary>
  141 + public Method Method { get; private set; }
  142 +
  143 + public MissingRequiredArgumentException(Method method, string parameter)
  144 + : base("Missing argument for required parameter '{0}'".FormatWith(parameter))
  145 + {
  146 + Method = method;
  147 + ParameterName = parameter;
  148 + }
  149 +
  150 + public MissingRequiredArgumentException(string message, Exception inner) : base(message, inner) { }
  151 + protected MissingRequiredArgumentException(
  152 + System.Runtime.Serialization.SerializationInfo info,
  153 + System.Runtime.Serialization.StreamingContext context)
  154 + : base(info, context) { }
  155 + }
  156 +
  157 + [Serializable]
  158 + public class MissingArgumentValueException : CommandLineParserException
  159 + {
  160 + /// <summary>
  161 + /// The name of the parameter
  162 + /// </summary>
  163 + public string ParameterName { get; private set; }
  164 +
  165 + public MissingArgumentValueException(string parameter)
  166 + : base("Parameter {0} has no input and is not a switch".FormatWith(parameter))
  167 + {
  168 + ParameterName = parameter;
  169 + }
  170 +
  171 + public MissingArgumentValueException(string message, Exception inner) : base(message, inner) { }
  172 + protected MissingArgumentValueException(
  173 + System.Runtime.Serialization.SerializationInfo info,
  174 + System.Runtime.Serialization.StreamingContext context)
  175 + : base(info, context) { }
  176 + }
  177 +
  178 + [Serializable]
  179 + public class MissingArgumentPrefixException : CommandLineParserException
  180 + {
  181 + /// <summary>
  182 + /// The name of the parameter
  183 + /// </summary>
  184 + public string ParameterName { get; private set; }
  185 +
  186 + public MissingArgumentPrefixException(string parameter, string prefixes)
  187 + : base("'{0}' should be prefixed with one of '{1}'".FormatWith(parameter, prefixes))
  188 + {
  189 + ParameterName = parameter;
  190 + }
  191 +
  192 + public MissingArgumentPrefixException(string message, Exception inner) : base(message, inner) { }
  193 + protected MissingArgumentPrefixException(
  194 + System.Runtime.Serialization.SerializationInfo info,
  195 + System.Runtime.Serialization.StreamingContext context)
  196 + : base(info, context) { }
  197 + }
  198 +
  199 + [Serializable]
  200 + public class ValidationException : CommandLineParserException
  201 + {
  202 + public ValidationException(string message) : base(message) { }
  203 + public ValidationException(string message, Exception inner) : base(message, inner) { }
  204 + protected ValidationException(
  205 + System.Runtime.Serialization.SerializationInfo info,
  206 + System.Runtime.Serialization.StreamingContext context)
  207 + : base(info, context) { }
  208 + }
  209 +
  210 + [Serializable]
  211 + public class TypeConvertionException : CommandLineParserException
  212 + {
  213 + /// <summary>
  214 + /// The string value that failed to be converted
  215 + /// </summary>
  216 + public string Value { get; private set; }
  217 +
  218 + /// <summary>
  219 + /// The target type
  220 + /// </summary>
  221 + public Type Type { get; private set; }
  222 +
  223 + public TypeConvertionException(string value, Type type, Exception inner)
  224 + : base("'{0}' cannot be converted to {1}".FormatWith(value, type), inner)
  225 + {
  226 + Value = value;
  227 + Type = type;
  228 + }
  229 +
  230 + protected TypeConvertionException(
  231 + System.Runtime.Serialization.SerializationInfo info,
  232 + System.Runtime.Serialization.StreamingContext context)
  233 + : base(info, context) { }
  234 + }
  235 +
  236 + [Serializable]
  237 + public class MoreThanOneEmptyHandlerException : CommandLineParserException
  238 + {
  239 + public MoreThanOneEmptyHandlerException()
  240 + : base("More than one empty handler was defined. Only a single method can be marked with [Empty] in a type and only a single action can be registered as an empty handler.")
  241 + {
  242 + }
  243 +
  244 + protected MoreThanOneEmptyHandlerException(
  245 + System.Runtime.Serialization.SerializationInfo info,
  246 + System.Runtime.Serialization.StreamingContext context)
  247 + : base(info, context) { }
  248 + }
  249 +
  250 + [Serializable]
  251 + public class MoreThanOneErrorHandlerException : CommandLineParserException
  252 + {
  253 + public MoreThanOneErrorHandlerException()
  254 + : base("More than one error handler was defined. Only a single method can be marked with [Error] in a type and only a single action can be registered as an error handler.")
  255 + {
  256 + }
  257 +
  258 + protected MoreThanOneErrorHandlerException(
  259 + System.Runtime.Serialization.SerializationInfo info,
  260 + System.Runtime.Serialization.StreamingContext context)
  261 + : base(info, context) { }
  262 + }
  263 +
  264 + [Serializable]
  265 + public class MoreThanOnePreVerbInterceptorException : CommandLineParserException
  266 + {
  267 + public MoreThanOnePreVerbInterceptorException()
  268 + : base("More than one pre-verb interceptor was defined. Only a single method can be marked with [PreVerbExecutionAttribute] in a type and only a single action can be registered as a pre-interceptor.")
  269 + {
  270 + }
  271 +
  272 + protected MoreThanOnePreVerbInterceptorException(
  273 + System.Runtime.Serialization.SerializationInfo info,
  274 + System.Runtime.Serialization.StreamingContext context)
  275 + : base(info, context) { }
  276 + }
  277 +
  278 + [Serializable]
  279 + public class MoreThanOnePostVerbInterceptorException : CommandLineParserException
  280 + {
  281 + public MoreThanOnePostVerbInterceptorException()
  282 + : base("More than one post-verb interceptor was defined. Only a single method can be marked with [PostVerbExecutionAttribute] in a type and only a single action can be registered as a post-interceptor.")
  283 + {
  284 + }
  285 +
  286 + protected MoreThanOnePostVerbInterceptorException(
  287 + System.Runtime.Serialization.SerializationInfo info,
  288 + System.Runtime.Serialization.StreamingContext context)
  289 + : base(info, context) { }
  290 + }
  291 +
  292 + [Serializable]
  293 + public class ArgumentMismatchException : CommandLineParserException
  294 + {
  295 + public ArgumentMismatchException() { }
  296 + public ArgumentMismatchException(string message) : base(message) { }
  297 + public ArgumentMismatchException(string message, Exception inner) : base(message, inner) { }
  298 + protected ArgumentMismatchException(
  299 + System.Runtime.Serialization.SerializationInfo info,
  300 + System.Runtime.Serialization.StreamingContext context)
  301 + : base(info, context) { }
  302 + }
  303 +
  304 + [Serializable]
  305 + public class ParserExecutionTargetException : CommandLineParserException
  306 + {
  307 + public ParserExecutionTargetException() { }
  308 + public ParserExecutionTargetException(string message) : base(message) { }
  309 + public ParserExecutionTargetException(string message, Exception inner) : base(message, inner) { }
  310 + protected ParserExecutionTargetException(
  311 + System.Runtime.Serialization.SerializationInfo info,
  312 + System.Runtime.Serialization.StreamingContext context)
  313 + : base(info, context) { }
  314 + }
  315 +
  316 + [Serializable]
  317 + public class UnhandledParametersException : CommandLineParserException
  318 + {
  319 + /// <summary>
  320 + /// The collection of unhandled arguments
  321 + /// </summary>
  322 + public Dictionary<string, string> UnhandledParameters { get; private set; }
  323 +
  324 + public UnhandledParametersException(Dictionary<string, string> unhandledParameters)
  325 + : base("Unhandled parameters: '{0}'".FormatWith(unhandledParameters.Keys.StringJoin(", ")))
  326 + {
  327 + UnhandledParameters = unhandledParameters;
  328 + }
  329 +
  330 + protected UnhandledParametersException(
  331 + System.Runtime.Serialization.SerializationInfo info,
  332 + System.Runtime.Serialization.StreamingContext context)
  333 + : base(info, context) { }
  334 + }
  335 +
  336 + [Serializable]
  337 + public class MoreThanOneDefaultVerbException : CommandLineParserException
  338 + {
  339 + /// <summary>
  340 + /// The collection of the verbs that are defined as default
  341 + /// </summary>
  342 + public IEnumerable<string> Verbs { get; private set; }
  343 +
  344 + public MoreThanOneDefaultVerbException(IEnumerable<string> verbs)
  345 + : base("More than one default verb was defined: '{0}'".FormatWith(verbs.StringJoin(", ")))
  346 + {
  347 + Verbs = verbs;
  348 + }
  349 +
  350 + protected MoreThanOneDefaultVerbException(
  351 + System.Runtime.Serialization.SerializationInfo info,
  352 + System.Runtime.Serialization.StreamingContext context)
  353 + : base(info, context) { }
  354 + }
  355 +
  356 + [Serializable]
  357 + public class InvalidHelpHandlerException : CommandLineParserException
  358 + {
  359 + /// <summary>
  360 + /// The method that is defined as help
  361 + /// </summary>
  362 + public MethodInfo Method { get; private set; }
  363 +
  364 + public InvalidHelpHandlerException(MethodInfo method)
  365 + : this(method, null)
  366 + {
  367 + }
  368 +
  369 + public InvalidHelpHandlerException(MethodInfo method, Exception ex)
  370 + : base("Method '{0}' is marked as [Help] but it does not have a single string parameter".FormatWith(method.Name), ex)
  371 + {
  372 + Method = method;
  373 + }
  374 +
  375 + protected InvalidHelpHandlerException(
  376 + System.Runtime.Serialization.SerializationInfo info,
  377 + System.Runtime.Serialization.StreamingContext context)
  378 + : base(info, context) { }
  379 + }
  380 +
  381 + [Serializable]
  382 + public class AmbiguousParameterDefaultException : CommandLineParserException
  383 + {
  384 + /// <summary>
  385 + /// The parameter that has both a Default and a DefaultProvider
  386 + /// </summary>
  387 + public ParameterInfo Parameter { get; private set; }
  388 +
  389 + public AmbiguousParameterDefaultException(ParameterInfo parameter)
  390 + : base("Parameter '{0}' of '{1}' has both a Default and a DefaultProvider".FormatWith(parameter.Name, parameter.Member.Name))
  391 + {
  392 + Parameter = parameter;
  393 + }
  394 +
  395 + protected AmbiguousParameterDefaultException(
  396 + System.Runtime.Serialization.SerializationInfo info,
  397 + System.Runtime.Serialization.StreamingContext context)
  398 + : base(info, context) { }
  399 + }
  400 +
  401 + [Serializable]
  402 + public class InvalidParameterDefaultProviderException : CommandLineParserException
  403 + {
  404 + /// <summary>
  405 + /// The parameter that has an invalid DefaultProvider
  406 + /// </summary>
  407 + public ParameterInfo Parameter { get; private set; }
  408 +
  409 + public InvalidParameterDefaultProviderException(ParameterInfo parameter)
  410 + : base("Parameter '{0}' of '{1}' has an invalid DefaultProvider".FormatWith(parameter.Name, parameter.Member.Name))
  411 + {
  412 + Parameter = parameter;
  413 + }
  414 +
  415 + protected InvalidParameterDefaultProviderException(
  416 + System.Runtime.Serialization.SerializationInfo info,
  417 + System.Runtime.Serialization.StreamingContext context)
  418 + : base(info, context) { }
  419 + }
  420 +
  421 + [Serializable]
  422 + public class DuplicateGlobalHandlerException : CommandLineParserException
  423 + {
  424 + /// <summary>
  425 + /// The global handler name
  426 + /// </summary>
  427 + public string Name { get; private set; }
  428 +
  429 + public DuplicateGlobalHandlerException(string name)
  430 + : base("Global parameter '{0}' is defined more than once".FormatWith(name))
  431 + {
  432 + Name = name;
  433 + }
  434 +
  435 + protected DuplicateGlobalHandlerException(
  436 + System.Runtime.Serialization.SerializationInfo info,
  437 + System.Runtime.Serialization.StreamingContext context)
  438 + : base(info, context) { }
  439 + }
  440 +
  441 + [Serializable]
  442 + public class NonArrayParameterWithSeparatorException : CommandLineParserException
  443 + {
  444 + /// <summary>
  445 + /// The parameter
  446 + /// </summary>
  447 + public ParameterInfo Parameter { get; private set; }
  448 +
  449 + public NonArrayParameterWithSeparatorException(ParameterInfo parameter)
  450 + : base("Parameter '{0}' of '{1}' is marked with [{2}] but it is not an array".FormatWith(
  451 + parameter.Name,
  452 + parameter.Member.Name,
  453 + typeof(SeparatorAttribute).Name))
  454 + {
  455 + Parameter = parameter;
  456 + }
  457 +
  458 + protected NonArrayParameterWithSeparatorException(
  459 + System.Runtime.Serialization.SerializationInfo info,
  460 + System.Runtime.Serialization.StreamingContext context)
  461 + : base(info, context) { }
  462 + }
  463 +
  464 + [Serializable]
  465 + public class InvalidSeparatorException : CommandLineParserException
  466 + {
  467 + /// <summary>
  468 + /// The parameter
  469 + /// </summary>
  470 + public ParameterInfo Parameter { get; private set; }
  471 +
  472 + public InvalidSeparatorException(ParameterInfo parameter)
  473 + : base("Parameter '{0}' of '{1}' has an invalid separator. A separator cannot be empty or contain spaces.".FormatWith(
  474 + parameter.Name,
  475 + parameter.Member.Name))
  476 + {
  477 + Parameter = parameter;
  478 + }
  479 +
  480 + protected InvalidSeparatorException(
  481 + System.Runtime.Serialization.SerializationInfo info,
  482 + System.Runtime.Serialization.StreamingContext context)
  483 + : base(info, context) { }
  484 + }
  485 +}
336 Libs/CLAP/CLAP/FW2Stuff.cs
... ... @@ -0,0 +1,336 @@
  1 +#if FW2
  2 +using System;
  3 +using System.Collections;
  4 +using System.Collections.Generic;
  5 +
  6 +namespace CLAP
  7 +{
  8 + #region Delegates
  9 +
  10 + public delegate void Action();
  11 + public delegate void Action<T>(T arg);
  12 + public delegate void Action<T1, T2>(T1 arg1, T2 arg2);
  13 +
  14 + public delegate TResult Func<TResult>();
  15 + public delegate TResult Func<T, TResult>(T arg);
  16 + public delegate TResult Func<T1, T2, TResult>(T1 arg1, T2 arg2);
  17 + public delegate TResult Func<T1, T2, T3, TResult>(T1 arg1, T2 arg2, T3 arg3);
  18 +
  19 + #endregion Delegates
  20 +
  21 + #region Enumerable
  22 +
  23 + internal static class Enumerable
  24 + {
  25 + public static IEnumerable<T> Cast<T>(this IEnumerable collection)
  26 + {
  27 + foreach (var item in collection)
  28 + {
  29 + yield return (T)item;
  30 + }
  31 + }
  32 +
  33 + public static IEnumerable<T> Where<T>(this IEnumerable<T> collection, Func<T, bool> predicate)
  34 + {
  35 + foreach (var item in collection)
  36 + {
  37 + if (predicate(item))
  38 + {
  39 + yield return item;
  40 + }
  41 + }
  42 + }
  43 +
  44 + public static T First<T>(this IEnumerable<T> collection)
  45 + {
  46 + foreach (var item in collection)
  47 + {
  48 + return item;
  49 + }
  50 +
  51 + throw new InvalidOperationException("No elements in the collection that matches the predicate");
  52 + }
  53 +
  54 + public static T First<T>(this IEnumerable<T> collection, Func<T, bool> predicate)
  55 + {
  56 + foreach (var item in collection)
  57 + {
  58 + if (predicate(item))
  59 + {
  60 + return item;
  61 + }
  62 + }
  63 +
  64 + throw new InvalidOperationException("No elements in the collection that matches the predicate");
  65 + }
  66 +
  67 + public static T FirstOrDefault<T>(this IEnumerable<T> collection)
  68 + {
  69 + foreach (var item in collection)
  70 + {
  71 + return item;
  72 + }
  73 +
  74 + return default(T);
  75 + }
  76 +
  77 + public static T FirstOrDefault<T>(this IEnumerable<T> collection, Func<T, bool> predicate)
  78 + {
  79 + foreach (var item in collection)
  80 + {
  81 + if (predicate(item))
  82 + {
  83 + return item;
  84 + }
  85 + }
  86 +
  87 + return default(T);
  88 + }
  89 +
  90 + public static bool Any<T>(this IEnumerable<T> collection)
  91 + {
  92 + foreach (var item in collection)
  93 + {
  94 + return true;
  95 + }
  96 +
  97 + return false;
  98 + }
  99 +
  100 + public static bool Any<T>(this IEnumerable<T> collection, Func<T, bool> predicate)
  101 + {
  102 + foreach (var item in collection)
  103 + {
  104 + if (predicate(item))
  105 + {
  106 + return true;
  107 + }
  108 + }
  109 +
  110 + return false;
  111 + }
  112 +
  113 + public static bool All<T>(this IEnumerable<T> collection, Func<T, bool> predicate)
  114 + {
  115 + foreach (var item in collection)
  116 + {
  117 + if (!predicate(item))
  118 + {
  119 + return false;
  120 + }
  121 + }
  122 +
  123 + return true;
  124 + }
  125 +
  126 + public static int Count<T>(this IEnumerable<T> collection)
  127 + {
  128 + var c = 0;
  129 +
  130 + foreach (var item in collection)
  131 + {
  132 + c++;
  133 + }
  134 +
  135 + return c;
  136 + }
  137 +
  138 + public static int Count<T>(this IEnumerable<T> collection, Func<T, bool> predicate)
  139 + {
  140 + var c = 0;
  141 +
  142 + foreach (var item in collection)
  143 + {
  144 + if (predicate(item))
  145 + {
  146 + c++;
  147 + }
  148 + }
  149 +
  150 + return c;
  151 + }
  152 +
  153 + public static T[] ToArray<T>(this IEnumerable<T> collection)
  154 + {
  155 + var arr = new T[collection.Count()];
  156 +
  157 + var i = 0;
  158 +
  159 + foreach (var item in collection)
  160 + {
  161 + arr[i] = item;
  162 +
  163 + i++;
  164 + }
  165 +
  166 + return arr;
  167 + }
  168 +
  169 + public static IEnumerable<TItem> OrderBy<TItem, TResult>(
  170 + this IEnumerable<TItem> collection,
  171 + Func<TItem, TResult> func)
  172 + {
  173 + var items = collection.ToArray();
  174 + var keysList = new List<TResult>();
  175 +
  176 + foreach (var item in collection)
  177 + {
  178 + keysList.Add(func(item));
  179 + }
  180 +
  181 + var keys = keysList.ToArray();
  182 +
  183 + Array.Sort(keys, items);
  184 +
  185 + return items;
  186 + }
  187 +
  188 + public static IEnumerable<TItem> OrderByDescending<TItem, TResult>(
  189 + this IEnumerable<TItem> collection,
  190 + Func<TItem, TResult> func)
  191 + {
  192 + var arr = OrderBy(collection, func).ToArray();
  193 +
  194 + Array.Reverse(arr);
  195 +
  196 + return arr;
  197 + }
  198 +
  199 + public static IEnumerable<T> Skip<T>(this IEnumerable<T> collection, int count)
  200 + {
  201 + foreach (var item in collection)
  202 + {
  203 + count--;
  204 +
  205 + if (count >= 0)
  206 + {
  207 + continue;
  208 + }
  209 +
  210 + yield return item;
  211 + }
  212 + }
  213 +
  214 + public static IEnumerable<TResult> Select<TSource, TResult>(
  215 + this IEnumerable<TSource> collection,
  216 + Func<TSource, TResult> selector)
  217 + {
  218 + foreach (var item in collection)
  219 + {
  220 + yield return selector(item);
  221 + }
  222 + }
  223 +
  224 + public static IEnumerable<TResult> SelectMany<TSource, TResult>(
  225 + this IEnumerable<TSource> collection,
  226 + Func<TSource, IEnumerable<TResult>> selector)
  227 + {
  228 + foreach (var item in collection)
  229 + {
  230 + var innerItems = selector(item);
  231 +
  232 + foreach (var innerItem in innerItems)
  233 + {
  234 + yield return innerItem;
  235 + }
  236 + }
  237 + }
  238 +
  239 + public static IEnumerable<T> Distinct<T>(this IEnumerable<T> collection)
  240 + {
  241 + var list = new List<T>();
  242 +
  243 + foreach (var item in collection)
  244 + {
  245 + if (!list.Contains(item))
  246 + {
  247 + list.Add(item);
  248 +
  249 + yield return item;
  250 + }
  251 + }
  252 + }
  253 +
  254 + public static IEnumerable<TSource> Union<TSource>(
  255 + this IEnumerable<TSource> first,
  256 + IEnumerable<TSource> second)
  257 + {
  258 + foreach (var item in first)
  259 + {
  260 + yield return item;
  261 + }
  262 +
  263 + foreach (var item in second)
  264 + {
  265 + yield return item;
  266 + }
  267 + }
  268 +
  269 + public static bool Contains<TSource>(this IEnumerable<TSource> source, TSource value)
  270 + {
  271 + foreach (var item in source)
  272 + {
  273 + if (object.Equals(item, value))
  274 + {
  275 + return true;
  276 + }
  277 + }
  278 +
  279 + return false;
  280 + }
  281 +
  282 + public static List<T> ToList<T>(this IEnumerable<T> collection)
  283 + {
  284 + var list = new List<T>();
  285 +
  286 + foreach (var item in collection)
  287 + {
  288 + list.Add(item);
  289 + }
  290 +
  291 + return list;
  292 + }
  293 +
  294 + public static Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement>(
  295 + this IEnumerable<TSource> source,
  296 + Func<TSource, TKey> keySelector,
  297 + Func<TSource, TElement> elementSelector)
  298 + {
  299 + var dict = new Dictionary<TKey, TElement>();
  300 +
  301 + foreach (var item in source)
  302 + {
  303 + dict.Add(keySelector(item), elementSelector(item));
  304 + }
  305 +
  306 + return dict;
  307 + }
  308 +
  309 + public static int Max<TSource>(this IEnumerable<TSource> source, Func<TSource, int> selector)
  310 + {
  311 + int? max = null;
  312 +
  313 + foreach (var item in source)
  314 + {
  315 + var v = selector(item);
  316 +
  317 + if (!max.HasValue || v > max)
  318 + {
  319 + max = v;
  320 + }
  321 + }
  322 +
  323 + return max.Value;
  324 + }
  325 + }
  326 +
  327 + #endregion Enumerable
  328 +}
  329 +
  330 +namespace System.Runtime.CompilerServices
  331 +{
  332 + internal class ExtensionAttribute : Attribute
  333 + {
  334 + }
  335 +}
  336 +#endif
36 Libs/CLAP/CLAP/FileSystemHelper.cs
... ... @@ -0,0 +1,36 @@
  1 +using System.IO;
  2 +
  3 +namespace CLAP
  4 +{
  5 + /// <summary>
  6 + /// A helper for file reading to allow mocking for tests
  7 + /// </summary>
  8 + public static class FileSystemHelper
  9 + {
  10 + public static IFileSystem FileHandler { get; set; }
  11 +
  12 + static FileSystemHelper()
  13 + {
  14 + FileHandler = new FileSystem();
  15 + }
  16 +
  17 + internal static string ReadAllText(string path)
  18 + {
  19 + return FileHandler.ReadAllText(path);
  20 + }
  21 +
  22 + public interface IFileSystem
  23 + {
  24 + string ReadAllText(string path);
  25 + }
  26 +
  27 + [CoverageExclude]
  28 + private class FileSystem : IFileSystem
  29 + {
  30 + public string ReadAllText(string path)
  31 + {
  32 + return File.ReadAllText(path);
  33 + }
  34 + }
  35 + }
  36 +}
42 Libs/CLAP/CLAP/GlobalAttribute.cs
... ... @@ -0,0 +1,42 @@
  1 +using System;
  2 +
  3 +namespace CLAP
  4 +{
  5 + /// <summary>
  6 + /// Marks a method as a global parameter.
  7 + /// The method can either accept any single allowed parameter type or accept
  8 + /// no parameters and be treated as a boolean switch.
  9 + /// </summary>
  10 + [Serializable]
  11 + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
  12 + public sealed class GlobalAttribute : Attribute
  13 + {
  14 + /// <summary>
  15 + /// The additional aliases (as CSV) of the parameter
  16 + /// </summary>
  17 + public string Aliases { get; set; }
  18 +
  19 + /// <summary>
  20 + /// The description of this parameter
  21 + /// </summary>
  22 + public string Description { get; set; }
  23 +
  24 + /// <summary>
  25 + /// The name of this parameter
  26 + /// </summary>
  27 + public string Name { get; private set; }
  28 +
  29 + public GlobalAttribute()
  30 + : this(null)
  31 + {
  32 +
  33 + }
  34 +
  35 + public GlobalAttribute(string name)
  36 + {
  37 + Aliases = string.Empty;
  38 +
  39 + Name = name;
  40 + }
  41 + }
  42 +}
35 Libs/CLAP/CLAP/HelpAttribute.cs
... ... @@ -0,0 +1,35 @@
  1 +using System;
  2 +
  3 +namespace CLAP
  4 +{
  5 + /// <summary>
  6 + /// Marks a method to be called when the user asks for help
  7 + /// </summary>
  8 + [Serializable]
  9 + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
  10 + public sealed class HelpAttribute : Attribute
  11 + {
  12 + /// <summary>
  13 + /// The additional aliases (as CSV) of the parameter
  14 + /// </summary>
  15 + public string Aliases { get; set; }
  16 +
  17 + /// <summary>
  18 + /// The name of this parameter
  19 + /// </summary>
  20 + public string Name { get; private set; }
  21 +
  22 + public HelpAttribute()
  23 + : this(null)
  24 + {
  25 +
  26 + }
  27 +
  28 + public HelpAttribute(string name)
  29 + {
  30 + Aliases = string.Empty;
  31 +
  32 + Name = name;
  33 + }
  34 + }
  35 +}
238 Libs/CLAP/CLAP/HelpGenerator.cs
... ... @@ -0,0 +1,238 @@
  1 +using System;
  2 +using System.Collections.Generic;
  3 +using System.Text;
  4 +
  5 +#if !FW2
  6 +using System.Linq;
  7 +#endif
  8 +
  9 +namespace CLAP
  10 +{
  11 + internal static class HelpGenerator
  12 + {
  13 + internal static string GetHelp(MultiParser parser)
  14 + {
  15 + var parsers = parser.Types.Select(t => new ParserRunner(t, parser.Register));
  16 +
  17 + return GetHelp(parsers);
  18 + }
  19 +
  20 + internal static string GetHelp(ParserRunner parser)
  21 + {
  22 + return GetHelp(new[] { parser });
  23 + }
  24 +
  25 + internal static string GetHelp(IEnumerable<ParserRunner> parsers)
  26 + {
  27 + var help = new HelpInfo();
  28 +
  29 + help.Parsers = parsers.Select(p => GetParserHelp(p)).ToList();
  30 +
  31 + var helpString = GetHelpString(help);
  32 +
  33 + return helpString;