fix code merge conflicts

This commit is contained in:
xieguigang 2019-12-08 18:01:27 +08:00
commit 91e67f2c8d
700 changed files with 8396 additions and 3771 deletions

View File

@ -263,8 +263,8 @@ Global
{8CDE6B49-9B2B-4A0E-8954-5A46E9AECB88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CDE6B49-9B2B-4A0E-8954-5A46E9AECB88}.Debug|Win32.ActiveCfg = Debug|Any CPU
{8CDE6B49-9B2B-4A0E-8954-5A46E9AECB88}.Debug|Win32.Build.0 = Debug|Any CPU
{8CDE6B49-9B2B-4A0E-8954-5A46E9AECB88}.Debug|x64.ActiveCfg = Debug|Any CPU
{8CDE6B49-9B2B-4A0E-8954-5A46E9AECB88}.Debug|x64.Build.0 = Debug|Any CPU
{8CDE6B49-9B2B-4A0E-8954-5A46E9AECB88}.Debug|x64.ActiveCfg = Debug|x64
{8CDE6B49-9B2B-4A0E-8954-5A46E9AECB88}.Debug|x64.Build.0 = Debug|x64
{8CDE6B49-9B2B-4A0E-8954-5A46E9AECB88}.Debug|x86.ActiveCfg = Debug|x86
{8CDE6B49-9B2B-4A0E-8954-5A46E9AECB88}.Debug|x86.Build.0 = Debug|x86
{8CDE6B49-9B2B-4A0E-8954-5A46E9AECB88}.DEMO|Any CPU.ActiveCfg = Debug|Any CPU

View File

@ -91,7 +91,7 @@
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>..\..\..\..\GCModeller\bin\</OutputPath>
<OutputPath>bin\</OutputPath>
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
@ -104,9 +104,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineTrace>true</DefineTrace>
<OutputPath>..\..\..\..\GCModeller\bin\</OutputPath>
<OutputPath>bin\</OutputPath>
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<Optimize>false</Optimize>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
@ -166,7 +166,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Publish|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineTrace>true</DefineTrace>
<OutputPath>..\..\..\..\GCModeller\bin\</OutputPath>
<OutputPath>..\CLI_tools\MLkit\Apps\</OutputPath>
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
@ -333,9 +333,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Biodeep|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineTrace>true</DefineTrace>
<OutputPath>..\..\..\..\..\smartnucl_integrative\biodeepDB\METLINApp\App\</OutputPath>
<OutputPath>bin\app\</OutputPath>
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<Optimize>false</Optimize>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
@ -385,9 +385,9 @@
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<Optimize>true</Optimize>
<Optimize>false</Optimize>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
<DebugType>Full</DebugType>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
@ -571,7 +571,7 @@
<DefineConstants>FRAMEWORD_CORE=1,UNIX=1</DefineConstants>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<Optimize>true</Optimize>
<Optimize>false</Optimize>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
<DebugType>Full</DebugType>
<PlatformTarget>x64</PlatformTarget>
@ -619,7 +619,7 @@
<DefineConstants>FRAMEWORD_CORE=1,UNIX=1</DefineConstants>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<Optimize>true</Optimize>
<Optimize>false</Optimize>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
<DebugType>Full</DebugType>
<PlatformTarget>x64</PlatformTarget>
@ -794,7 +794,7 @@
<DebugSymbols>true</DebugSymbols>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Biostack\</OutputPath>
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<DefineConstants>FRAMEWORD_CORE=1,UNIX=True</DefineConstants>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<Optimize>true</Optimize>
@ -899,6 +899,78 @@
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'node-debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\node-debug\</OutputPath>
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'node-debug|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\node-debug\</OutputPath>
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'node-debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\node-debug\</OutputPath>
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'test|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\test\</OutputPath>
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'test|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\test\</OutputPath>
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'test|x86'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\test\</OutputPath>
<DefineConstants>FRAMEWORD_CORE=1</DefineConstants>
<DocumentationFile>Microsoft.VisualBasic.Framework_v47_dotnet_8da45dcd8060cc9a.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualC" />
<Reference Include="Microsoft.VisualC.STLCLR" />
@ -942,10 +1014,29 @@
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationServices\Debugger\Exception\StackFrame.vb" />
<Compile Include="ApplicationServices\Terminal\MarkdownRender\Theme.vb" />
<Compile Include="ApplicationServices\Terminal\MarkdownRender\MarkdownRender.vb" />
<Compile Include="ApplicationServices\Terminal\xConsole\Comparer.vb" />
<Compile Include="ApplicationServices\Terminal\xConsole\Spinner.vb" />
<Compile Include="ApplicationServices\Terminal\xConsole\CoolWriteSettings.vb" />
<Compile Include="ComponentModel\Algorithm\BinaryTree\AVLTree\AVLClusterTree.vb" />
<Compile Include="ComponentModel\System.Collections.Generic\BinaryHeap.vb" />
<Compile Include="Data\NamespaceDoc.vb" />
<Compile Include="Data\Repository\RepositoryFileSystem.vb" />
<Compile Include="Extensions\Collection\CategoryOperations.vb" />
<Compile Include="Extensions\Math\StatisticsMathExtensions\SampleObservation.vb" />
<Compile Include="Extensions\Math\StatisticsMathExtensions\Min.vb" />
<Compile Include="Extensions\StringHelpers\StringFormats.vb" />
<Compile Include="My\Framework\FrameworkConfig.vb" />
<Compile Include="My\Framework\DoConfiguration.vb" />
<Compile Include="My\Framework\NamespaceDoc.vb" />
<Compile Include="ApplicationServices\Parallel\MMFProtocol\MMFChannel.vb" />
<Compile Include="ApplicationServices\ServerModule.vb" />
<Compile Include="ApplicationServices\Debugger\VisualStudioPreviews.vb" />
<Compile Include="ApplicationServices\Debugger\Exception\ExceptionData.vb" />
<Compile Include="ApplicationServices\Tools\Plugin\Loader.vb" />
<Compile Include="ApplicationServices\Tools\Plugin\PluginAttribute.vb" />
<Compile Include="ApplicationServices\Tools\Zip\StreamReader.vb" />
<Compile Include="ApplicationServices\Tools\Zip\UnZip.vb" />
<Compile Include="ApplicationServices\Tools\Zip\Options.vb" />
@ -953,17 +1044,20 @@
<Compile Include="ApplicationServices\VBDev\NamespaceDoc.vb" />
<Compile Include="ApplicationServices\VBDev\Ngen\Registry.vb" />
<Compile Include="ApplicationServices\VBDev\Signature\CodeSign.vb" />
<Compile Include="ApplicationServices\VBDev\Signature\SupportedLanguages.vb" />
<Compile Include="ApplicationServices\VBDev\Signature\VBCodeSignature.vb" />
<Compile Include="ApplicationServices\VBDev\Signature\LicenseInfo.vb" />
<Compile Include="ApplicationServices\VBDev\XmlDoc\Extensions\APIExtensions2.vb" />
<Compile Include="ApplicationServices\VBDev\XmlDoc\Extensions\VBSpecific.vb" />
<Compile Include="ApplicationServices\VBDev\XmlDoc\Serialization\NamespaceDoc.vb" />
<Compile Include="CommandLine\GitBashEnvironment.vb" />
<Compile Include="CommandLine\Interpreters\ExecuteImpl.vb" />
<Compile Include="CommandLine\Stream.vb" />
<Compile Include="CommandLine\InteropService\InCompatible.vb" />
<Compile Include="CommandLine\Interpreters\View\CommandHelp.vb" />
<Compile Include="CommandLine\Reflection\RunDll.vb" />
<Compile Include="ComponentModel\Algorithm\BinaryTree\BinaryTree.vb" />
<Compile Include="ComponentModel\Algorithm\BinaryTree\AVLTree.vb" />
<Compile Include="ComponentModel\Algorithm\BinaryTree\AVLTree\AVLTree.vb" />
<Compile Include="ComponentModel\Algorithm\BinaryTree\RBTree\Iterator.vb" />
<Compile Include="ComponentModel\Algorithm\BinaryTree\RBTree\RBNode.vb" />
<Compile Include="ComponentModel\Algorithm\BinaryTree\RBTree\RBTree.vb" />
@ -971,11 +1065,12 @@
<Compile Include="ComponentModel\Algorithm\BinaryTree\NaiveBinaryTree.vb" />
<Compile Include="ComponentModel\Algorithm\BinaryTree\Enumerable.vb" />
<Compile Include="ComponentModel\Algorithm\BinaryTree\TreeNode.vb" />
<Compile Include="ComponentModel\Algorithm\BinaryTree\AVLSupports.vb" />
<Compile Include="ComponentModel\Algorithm\BinaryTree\AVLTree\AVLSupports.vb" />
<Compile Include="ComponentModel\Algorithm\DynamicProgramming\LCS.vb" />
<Compile Include="ComponentModel\Algorithm\DynamicProgramming\LongestCommonSubsequence.vb" />
<Compile Include="ComponentModel\Algorithm\Levenshtein\DamerauLevenshteinDistance.vb" />
<Compile Include="ComponentModel\DataSource\DefaultAttribute.vb" />
<Compile Include="Data\TypeCaster.vb" />
<Compile Include="Data\DefaultAttribute.vb" />
<Compile Include="ComponentModel\DataSource\Property\GenericProperty.vb" />
<Compile Include="ComponentModel\File\XmlDataModel.vb" />
<Compile Include="ComponentModel\Ranges\Selector\IntTag.vb" />
@ -993,7 +1088,7 @@
<Compile Include="Extensions\Collection\Linq\Pipeline.vb" />
<Compile Include="Extensions\Collection\Linq\Takes.vb" />
<Compile Include="Extensions\Collection\Linq\SeqValue.vb" />
<Compile Include="Extensions\Collection\BucketExtensions.vb" />
<Compile Include="Extensions\Collection\BucketOperators.vb" />
<Compile Include="Extensions\Image\GDI+\Layouts\ColaExtensions.vb" />
<Compile Include="Extensions\Image\GDI+\Layouts\Point2D.vb" />
<Compile Include="Extensions\Image\Math\Models\PolarPoint.vb" />
@ -1011,10 +1106,10 @@
<Compile Include="Extensions\Math\Information\UncheckHelpers.vb" />
<Compile Include="Extensions\Math\StatisticsMathExtensions\Average.vb" />
<Compile Include="Extensions\StringHelpers\StringBuilders.vb" />
<Compile Include="Extensions\Trinity\Extensions.vb" />
<Compile Include="Extensions\Trinity\Expression.vb" />
<Compile Include="Extensions\Trinity\Word.vb" />
<Compile Include="Extensions\Trinity\WordClass.vb" />
<Compile Include="Data\Trinity\Extensions.vb" />
<Compile Include="Data\Trinity\Expression.vb" />
<Compile Include="Data\Trinity\Word.vb" />
<Compile Include="Data\Trinity\WordClass.vb" />
<Compile Include="Extensions\ValueTypes\TimeSpanScale.vb" />
<Compile Include="My\JavaScript\ES6\Map.vb" />
<Compile Include="My\JavaScript\Linq.vb" />
@ -1025,6 +1120,7 @@
<Compile Include="Language\Value\CharStream.vb" />
<Compile Include="Language\Value\Variant.vb" />
<Compile Include="My\File.vb" />
<Compile Include="Net\HTTP\wget.vb" />
<Compile Include="Net\HTTP\Stream\ZipStream.vb" />
<Compile Include="Net\HTTP\Multipart.vb" />
<Compile Include="Net\HTTP\DataURI.vb" />
@ -1037,12 +1133,12 @@
<Compile Include="CommandLine\InteropService\Abstract.vb" />
<Compile Include="CommandLine\InteropService\CLIAbstractor.vb" />
<Compile Include="CommandLine\InteropService\SharedORM\API.vb" />
<Compile Include="CommandLine\InteropService\SharedORM\Perl.vb" />
<Compile Include="CommandLine\InteropService\SharedORM\Languages\Perl.vb" />
<Compile Include="CommandLine\InteropService\SharedORM\CLI.vb" />
<Compile Include="CommandLine\InteropService\SharedORM\CodeGenerator.vb" />
<Compile Include="CommandLine\InteropService\SharedORM\R.vb" />
<Compile Include="CommandLine\InteropService\SharedORM\PHP.vb" />
<Compile Include="CommandLine\InteropService\SharedORM\VisualBasic.vb" />
<Compile Include="CommandLine\InteropService\SharedORM\Languages\R.vb" />
<Compile Include="CommandLine\InteropService\SharedORM\Languages\PHP.vb" />
<Compile Include="CommandLine\InteropService\SharedORM\Languages\VisualBasic.vb" />
<Compile Include="CommandLine\Parsers\CLIParser.vb" />
<Compile Include="CommandLine\Parsers\DictionaryParser.vb" />
<Compile Include="CommandLine\CLIMapper.vb" />
@ -1069,7 +1165,7 @@
<Compile Include="ComponentModel\Algorithm\base\SlideWindow\Extensions.vb" />
<Compile Include="ComponentModel\Algorithm\DynamicProgramming\SCS.vb" />
<Compile Include="ComponentModel\Count.vb" />
<Compile Include="ComponentModel\DataSource\Abstract.vb" />
<Compile Include="Data\Abstract.vb" />
<Compile Include="ComponentModel\DataSource\Repository\QueryCache.vb" />
<Compile Include="ComponentModel\DataStructures\Enumerable\NamedValueList.vb" />
<Compile Include="ComponentModel\DataStructures\Set\BadBehaviourResponses.vb" />
@ -1078,7 +1174,7 @@
<Compile Include="ComponentModel\DataStructures\Tree\BinaryTree\Extensions.vb" />
<Compile Include="ComponentModel\DataStructures\Tree\BinaryTree\Abstract.vb" />
<Compile Include="ComponentModel\DriverModel.vb" />
<Compile Include="ComponentModel\DataSource\Tsv.vb" />
<Compile Include="Data\Tsv.vb" />
<Compile Include="ComponentModel\DataSource\Property\NamedCollection.vb" />
<Compile Include="ComponentModel\DataSource\Property\PropertyValue.vb" />
<Compile Include="ComponentModel\DataSource\Property\IProperty.vb" />
@ -1102,6 +1198,7 @@
<Compile Include="ComponentModel\ValuePair\NamedTuple.vb" />
<Compile Include="Extensions\IO\Path\CopyDirectory.vb" />
<Compile Include="Extensions\Math\StatisticsMathExtensions\DataSample.vb" />
<Compile Include="Serialization\BinaryDumping\ObjectVisitor.vb" />
<Compile Include="Serialization\ICloneable.vb" />
<Compile Include="Text\Xml\Models\Sequence.vb" />
<Compile Include="ComponentModel\Ranges\Selector\IndexSelector.vb" />
@ -1128,7 +1225,7 @@
<Compile Include="Extensions\Collection\Linq\VectorAssertor.vb" />
<Compile Include="Extensions\Collection\Linq\NumericSequence.vb" />
<Compile Include="Extensions\Collection\Linq\Which.vb" />
<Compile Include="ApplicationServices\Debugger\VisualBasicAppException.vb" />
<Compile Include="ApplicationServices\Debugger\Exception\VisualBasicAppException.vb" />
<Compile Include="ComponentModel\DataSource\SchemaMaps\PropertyValue.vb" />
<Compile Include="Extensions\Collection\AnonymousTypeHelper.vb" />
<Compile Include="Extensions\Image\Bitmap\Effects.vb" />
@ -1223,15 +1320,15 @@
<Compile Include="ComponentModel\Settings\DataModels\ModelBase.vb" />
<Compile Include="ComponentModel\Settings\DataModels\ProfileItem.vb" />
<Compile Include="ComponentModel\Settings\Inf\Section.vb" />
<Compile Include="ApplicationServices\IOHandler.vb" />
<Compile Include="My\Framework\IOHandler.vb" />
<Compile Include="ComponentModel\ValuePair\GenericAbstract.vb" />
<Compile Include="ComponentModel\ValuePair\Binding.vb" />
<Compile Include="ComponentModel\ValuePair\TagData\TagData.vb" />
<Compile Include="Language\Language\UnixBash\ShellSyntax.vb" />
<Compile Include="Language\Language\UnixBash\Shell\tree.vb" />
<Compile Include="Language\Language\UnixBash\Shell\rm.vb" />
<Compile Include="Language\Value\Numeric\VBInteger.vb" />
<Compile Include="Language\Value\Numeric\VBDouble.vb" />
<Compile Include="Language\Value\Numeric\i32.vb" />
<Compile Include="Language\Value\Numeric\f64.vb" />
<Compile Include="Language\Value\var.vb" />
<Compile Include="ApplicationServices\Parallel\Tasks\Actor%28Of T, V%29.vb" />
<Compile Include="Scripting\Expressions\ArrayIndex.vb" />
@ -1243,17 +1340,17 @@
<Compile Include="My\InnerQueue.vb" />
<Compile Include="ApplicationServices\Terminal\InteractiveIODevice\TerminalExtensions.vb" />
<Compile Include="ApplicationServices\Terminal\PrintAsTable.vb" />
<Compile Include="ApplicationServices\Terminal\ProgressBar\AbstractBar.vb" />
<Compile Include="ApplicationServices\Terminal\ProgressBar\AnimatedBar.vb" />
<Compile Include="ApplicationServices\Terminal\ProgressBar\ProgressBar.vb" />
<Compile Include="ApplicationServices\Terminal\ProgressBar\Program.vb" />
<Compile Include="ApplicationServices\Terminal\ProgressBar\SwayBar.vb" />
<Compile Include="ApplicationServices\Terminal\Utility\ProgressBar\AbstractBar.vb" />
<Compile Include="ApplicationServices\Terminal\Utility\ProgressBar\AnimatedBar.vb" />
<Compile Include="ApplicationServices\Terminal\Utility\ProgressBar\ProgressBar.vb" />
<Compile Include="ApplicationServices\Terminal\Utility\ProgressBar\Program.vb" />
<Compile Include="ApplicationServices\Terminal\Utility\ProgressBar\SwayBar.vb" />
<Compile Include="ApplicationServices\Terminal\Utility\EventProc.vb" />
<Compile Include="ApplicationServices\Terminal\Utility\ConsolePasswordInput.vb" />
<Compile Include="ComponentModel\RelayCommand.vb" />
<Compile Include="ApplicationServices\Terminal\xConsole\Helpers.vb" />
<Compile Include="Extensions\Collection\Linq\SetValue.vb" />
<Compile Include="ApplicationServices\Debugger\Config.vb" />
<Compile Include="My\Framework\Config.vb" />
<Compile Include="Extensions\Image\Colors\HexColor.vb" />
<Compile Include="Extensions\IO\Path\Includes.vb" />
<Compile Include="Extensions\IO\Extensions\Extensions.vb" />
@ -1262,7 +1359,7 @@
<Compile Include="Extensions\IO\SymLinker\SymbolicLink.vb" />
<Compile Include="Extensions\Math\Random\RandomRange.vb" />
<Compile Include="Extensions\Math\Random\PreciseRandom.vb" />
<Compile Include="Extensions\Trinity\NLP\TextTokens.vb" />
<Compile Include="Data\Trinity\NLP\TextTokens.vb" />
<Compile Include="Extensions\Math\Trigonometric\Arctan.vb" />
<Compile Include="Extensions\Math\Trigonometric\Trigonometric2.vb" />
<Compile Include="Extensions\Math\Trigonometric\Trigonometric.vb" />
@ -1445,9 +1542,9 @@
<Compile Include="Text\StringSimilarity\Levenshtein\Extensions.vb" />
<Compile Include="Extensions\StringHelpers\StrUtils.vb" />
<Compile Include="Text\TextEncodings.vb" />
<Compile Include="Extensions\WebServices\HTTP_RFC.vb" />
<Compile Include="Net\HTTP\HTTP_RFC.vb" />
<Compile Include="Net\HTTP\Stream\Base64Codec.vb" />
<Compile Include="Extensions\WebServices\NetResponse.vb" />
<Compile Include="Net\Protocol\NetResponse.vb" />
<Compile Include="ApplicationServices\Tools\Win32\WindowsServices.vb" />
<Compile Include="Extensions\Security\Md5.vb" />
<Compile Include="Extensions\StringHelpers\StringHelpers.vb" />
@ -1489,7 +1586,7 @@
<Compile Include="Scripting\MetaData\EntryPointMetaData.vb" />
<Compile Include="ComponentModel\TimeSpan.vb" />
<Compile Include="ApplicationServices\Debugger\Logging\EventLog.vb" />
<Compile Include="ApplicationServices\Debugger\NETDebugger.vb" />
<Compile Include="ApplicationServices\Debugger\HeapSizeOf.vb" />
<Compile Include="Net\Abstract.vb" />
<Compile Include="Net\MIME\MIME.vb" />
<Compile Include="Net\MIME\ContentType.vb" />
@ -1504,7 +1601,7 @@
<Compile Include="Net\Protocol\Reflection\ProtocolHandler.vb" />
<Compile Include="Net\Protocol\RequestStream.vb" />
<Compile Include="Net\Tcp\Persistent\Protocols\POST.vb" />
<Compile Include="Net\wGetTools.vb" />
<Compile Include="Net\HTTP\wgetTask.vb" />
<Compile Include="Net\Tcp\StateObject.vb" />
<Compile Include="Net\Tcp\IPTools\IPEndPoint.vb" />
<Compile Include="Net\Tcp\IPTools\LAN.vb" />
@ -1556,7 +1653,7 @@
<Compile Include="ApplicationServices\VBDev\XmlDoc\Serialization\Models\Doc.vb" />
<Compile Include="ApplicationServices\VBDev\XmlDoc\Serialization\APIExtensions.vb" />
<Compile Include="ApplicationServices\Tools\Zip\ZipLib.vb" />
<Compile Include="ComponentModel\DataSource\DataFramework.vb" />
<Compile Include="Data\DataFramework.vb" />
<Compile Include="ApplicationServices\Terminal\Utility\CBusyIndicator.vb" />
<Compile Include="Extensions\Doc\LargeTextFile.vb" />
<Compile Include="Text\IO\TextFileEncodingDetector.vb" />

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::11d59e8cf799bd8b63b30b390b05215b, ApplicationServices\App.vb"
#Region "Microsoft.VisualBasic::215525b640c608ea63aa1549f3a52762, Microsoft.VisualBasic.Core\ApplicationServices\App.vb"
' Author:
'
@ -39,23 +39,22 @@
' InputFile, IsConsoleApp, IsMicrosoftPlatform, LocalData, LocalDataTemp
' LogErrDIR, NanoTime, NextTempName, OutFile, PID
' Platform, PreviousDirectory, Process, ProductName, ProductProgramData
' ProductSharedDIR, ProductSharedTemp, References, Running, RunTimeDirectory
' StartTime, StartupDirectory, StdErr, StdOut, SysTemp
' UnixTimeStamp, UserHOME, Version
' ProductSharedDIR, ProductSharedTemp, References, Running, RunningInGitBash
' RunTimeDirectory, StartTime, StartupDirectory, StdErr, StdInput
' StdOut, SysTemp, UnixTimeStamp, UserHOME, Version
'
' Constructor: (+1 Overloads) Sub New
'
' Function: __cli, __isMicrosoftPlatform, __listFiles, __sysTEMP, (+2 Overloads) Argument
' BugsFormatter, CLICode, ElapsedMilliseconds, Exit, finalizeCLI
' FormatTime, GenerateTemp, (+2 Overloads) GetAppLocalData, GetAppSysTempFile, GetAppVariables
' GetFile, GetNextUniqueName, GetProductSharedDIR, GetProductSharedTemp, GetTempFile
' GetVariable, (+3 Overloads) LogException, NullDevice, (+10 Overloads) RunCLI, RunCLIInternal
' SelfFolk, SelfFolks, Shell, tempCode, TemporaryEnvironment
' TraceBugs
' Function: __isMicrosoftPlatform, __listFiles, __sysTEMP, (+2 Overloads) Argument, BugsFormatter
' CLICode, ElapsedMilliseconds, Exit, finalizeCLI, FormatTime
' GenerateTemp, (+2 Overloads) GetAppLocalData, GetAppSysTempFile, GetAppVariables, GetFile
' GetNextUniqueName, GetProductSharedDIR, GetProductSharedTemp, GetTempFile, GetVariable
' (+3 Overloads) LogException, NullDevice, (+10 Overloads) RunCLI, RunCLIInternal, SelfFolk
' SelfFolks, Shell, tempCode, TemporaryEnvironment, TraceBugs
'
' Sub: __GCThreadInvoke, __removesTEMP, AddExitCleanHook, FlushMemory, Free
' JoinVariable, (+2 Overloads) JoinVariables, Pause, (+2 Overloads) println, RunAsAdmin
' SetBufferSize, StartGC, StopGC
' Sub: [Stop], __GCThreadInvoke, __removesTEMP, AddExitCleanHook, FlushMemory
' Free, JoinVariable, (+2 Overloads) JoinVariables, Pause, (+2 Overloads) println
' RunAsAdmin, SetBufferSize, StartGC, StopGC
'
' /********************************************************************************/
@ -175,10 +174,11 @@ Public Module App
Public ReadOnly Property StdErr As New StreamWriter(Console.OpenStandardError)
''' <summary>
''' <see cref="Console.OpenStandardOutput()"/> as default text output device.
''' <see cref="Console.OpenStandardOutput()"/> as default text output device. [<see cref="StreamWriter"/>]
''' </summary>
''' <returns></returns>
Public ReadOnly Property StdOut As [Default](Of TextWriter) = Console.OpenStandardOutput.OpenTextWriter
Public ReadOnly Property StdInput As [Default](Of TextReader) = New StreamReader(Console.OpenStandardInput)
''' <summary>
''' Get the <see cref="System.Diagnostics.Process"/> id(PID) of the current program process.
@ -194,7 +194,7 @@ Public Module App
''' Gets the command-line arguments for this <see cref="Process"/>.
''' </summary>
''' <returns>Gets the command-line arguments for this process.</returns>
Public ReadOnly Property CommandLine As CommandLine.CommandLine = __cli()
Public ReadOnly Property CommandLine As CommandLine.CommandLine = GitBashEnvironment.GetCLIArgs()
''' <summary>
''' Get argument value from <see cref="CommandLine"/>.
@ -223,28 +223,8 @@ Public Module App
Return CommandLine(name)
End Function
''' <summary>
''' Enable .NET application running from git bash terminal
''' </summary>
Const gitBash$ = "C:/Program Files/Git"
''' <summary>
''' Makes compatibility with git bash: <see cref="gitBash"/> = ``C:/Program Files/Git``
''' </summary>
''' <returns></returns>
Private Function __cli() As CommandLine.CommandLine
' 第一个参数为应用程序的文件路径不需要
Dim tokens$() =
Environment.GetCommandLineArgs _
.Skip(1) _
.Select(Function(t) t.Replace(gitBash, "")) _
.ToArray
Dim cliString$ = tokens.JoinBy(" ")
Dim cli = CLITools.TryParse(tokens, False, cliString)
Return cli
End Function
Public ReadOnly Property Github As String = LICENSE.githubURL
Public ReadOnly Property RunningInGitBash As Boolean = GitBashEnvironment.isRunningOnGitBash()
''' <summary>
''' Returns the argument portion of the <see cref="Microsoft.VisualBasic.CommandLine.CommandLine"/> used to start Visual Basic or
@ -460,7 +440,7 @@ Public Module App
End If
Call FileIO.FileSystem.CreateDirectory(AppSystemTemp)
Call FileIO.FileSystem.CreateDirectory(App.HOME & "/Resources/")
' Call FileIO.FileSystem.CreateDirectory(App.HOME & "/Resources/")
' 2018-08-14 因为经过测试发现text encoding模块会优先于命令行参数设置模块的初始化的加载
' 所以会导致环境变量为空
@ -494,15 +474,15 @@ Public Module App
#Region "这里的环境变量方法主要是操作从命令行之中所传递进来的额外的参数的"
Dim __joinedVariables As New Dictionary(Of NamedValue(Of String))
Dim m_joinedVariables As New Dictionary(Of NamedValue(Of String))
''' <summary>
''' 添加参数到应用程序的环境变量之中
''' </summary>
''' <param name="name$"></param>
''' <param name="name">如果给定的当前这个参数名称存在于当前框架环境中则会更新原来的值</param>
''' <param name="value$"></param>
Public Sub JoinVariable(name$, value$)
__joinedVariables(name) =
m_joinedVariables(name) =
New NamedValue(Of String) With {
.Name = name,
.Value = value
@ -515,7 +495,7 @@ Public Module App
''' <param name="vars"></param>
Public Sub JoinVariables(ParamArray vars As NamedValue(Of String)())
For Each v As NamedValue(Of String) In vars
__joinedVariables(v.Name) = v
m_joinedVariables(v.Name) = v
Next
End Sub
@ -541,10 +521,10 @@ Public Module App
''' </param>
''' <returns>当没有查找到相对应的环境变量的时候会返回空值</returns>
Public Function GetVariable(<CallerMemberName> Optional name$ = Nothing) As String
If __joinedVariables.ContainsKey(name) Then
Return __joinedVariables(name).Value
If m_joinedVariables.ContainsKey(name) Then
Return m_joinedVariables(name).Value
Else
For Each v As NamedValue(Of String) In __joinedVariables.Values
For Each v As NamedValue(Of String) In m_joinedVariables.Values
If v.Name.TextEquals(name) Then
Return v.Value
End If
@ -561,7 +541,7 @@ Public Module App
Public Function GetAppVariables() As NamedValue(Of String)()
Dim type As Type = GetType(App)
Dim pros = type.Schema(PropertyAccess.Readable, BindingFlags.Public Or BindingFlags.Static)
Dim out As New List(Of NamedValue(Of String))(__joinedVariables.Values)
Dim out As New List(Of NamedValue(Of String))(m_joinedVariables.Values)
Dim value$
Dim o
@ -649,7 +629,7 @@ Public Module App
''' </summary>
''' <remarks></remarks>
'''
<ExportAPI("FlushMemory", Info:="Rabbish collection To free the junk memory.")>
<ExportAPI("FlushMemory")>
Public Sub FlushMemory()
Call GC.Collect()
Call GC.WaitForPendingFinalizers()
@ -691,7 +671,7 @@ Public Module App
''' <param name="Prompted"></param>
''' <remarks></remarks>
'''
<ExportAPI("Pause", Info:="Pause the console program.")>
<ExportAPI("Pause")>
Public Sub Pause(Optional prompted$ = "Press any key to continute...")
Call My.InnerQueue.WaitQueue()
Call Console.WriteLine(prompted)
@ -703,6 +683,14 @@ Public Module App
End If
End Sub
''' <summary>
''' Pause and then exit the application.
''' </summary>
Public Sub [Stop]()
Call App.Pause()
Call App.Exit()
End Sub
''' <summary>
''' 使用<see cref="ProductSharedDIR"/>的位置会变化的则使用本函数则会使用获取当前的模块的文件夹即使其不是exe程序而是一个dll文件
''' </summary>
@ -720,10 +708,10 @@ Public Module App
End Function
''' <summary>
''' Get current time <see cref="Date"/> in unix time stamp format.
''' Get current time <see cref="Date"/> in ``xxxxx.xxxx`` unix time stamp format.
''' </summary>
''' <returns></returns>
Public ReadOnly Property UnixTimeStamp As Long
Public ReadOnly Property UnixTimeStamp As Double
<MethodImpl(MethodImplOptions.AggressiveInlining)>
Get
Return DateTimeHelper.UnixTimeStamp(Now)
@ -734,18 +722,21 @@ Public Module App
''' The time tag of the application started.(应用程序的启动的时间)
''' </summary>
''' <returns></returns>
Public ReadOnly Property StartTime As Long = UnixTimeStamp
Public ReadOnly Property StartTime As Double = App.UnixTimeStamp
''' <summary>
''' The distance of time that this application running from start and to current time.
''' (当前距离应用程序启动所逝去的时间)
''' </summary>
''' <returns></returns>
'''
''' <remarks>
''' 通过<see cref="App.UnixTimeStamp"/>以及<see cref="StartTime"/>得到的时间都是带小数的秒数
''' 所以在这里计算出当前时间点与启动时间点之间的差值之后还需要乘以1000才可以得到毫秒数
''' </remarks>
<ExportAPI("Elapsed.Milliseconds")>
Public Function ElapsedMilliseconds() As Long
Dim nowLng As Long = App.UnixTimeStamp
Dim d As Long = nowLng - StartTime
Dim nowLng As Double = App.UnixTimeStamp
Dim d As Long = (nowLng - StartTime) * 1000
Return d
End Function
@ -1040,6 +1031,13 @@ Public Module App
#Region "CLI interpreter"
''' <summary>
''' 当前的应用程序是否退出运行了? 当调用<see cref="App.Exit(Integer)"/>方法的时候, 除了会终止程序的运行
''' 还会讲这个属性设置为False
'''
''' 在应用程序框架中, 有一些组件的线程会需要依赖于这个属性值来自动停止运行
''' </summary>
''' <returns></returns>
Public ReadOnly Property Running As Boolean = True
''' <summary>
@ -1069,21 +1067,21 @@ Public Module App
''' <param name="args">The command line arguments value, which its value can be gets from the <see cref="Command()"/> function.</param>
''' <returns>Returns the function execute result to the operating system.</returns>
'''
<ExportAPI("RunCLI", Info:="Running the string as cli command line and the specific type define as a interpreter.")>
<ExportAPI("RunCLI")>
<Extension>
Public Function RunCLI(Interpreter As Type, args$, <CallerMemberName> Optional caller$ = Nothing) As Integer
Return Interpreter.RunCLIInternal(CLITools.TryParse(args), caller, Nothing, Nothing, Nothing)
End Function
''' <summary>
''' Running the string as a cli command line.(请注意在调试模式之下命令行解释器会在运行完命令之后暂停而Release模式之下则不会
''' Running the string as a cli command line, Running the string as cli command line and the specific type define as a interpreter.
''' (请注意在调试模式之下命令行解释器会在运行完命令之后暂停而Release模式之下则不会
''' 假若在调试模式之下发现程序有很长一段时间处于cpu占用为零的静止状态则很有可能已经运行完命令并且等待回车退出)
''' </summary>
''' <param name="args">The command line arguments value, which its value can be gets from the <see cref="Command()"/> function.</param>
''' <returns>Returns the function execute result to the operating system.</returns>
'''
<ExportAPI("RunCLI",
Info:="Running the string as cli command line and the specific type define as a interpreter.")>
<ExportAPI("RunCLI")>
<Extension> Public Function RunCLI(Interpreter As Type, args As CLI, <CallerMemberName> Optional caller$ = Nothing) As Integer
Return Interpreter.RunCLIInternal(args, caller, Nothing, Nothing, Nothing)
End Function
@ -1095,8 +1093,7 @@ Public Module App
''' <param name="args">The command line arguments value, which its value can be gets from the <see cref="Command()"/> function.</param>
''' <returns>Returns the function execute result to the operating system.</returns>
'''
<ExportAPI("RunCLI",
Info:="Running the string as cli command line and the specific type define as a interpreter.")>
<ExportAPI("RunCLI")>
<Extension> Public Function RunCLI(Interpreter As Type, args As CLI, executeEmpty As ExecuteEmptyCLI,
<CallerMemberName>
Optional caller$ = Nothing) As Integer

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::04369fce4edad7572df6e2634f9e59eb, ApplicationServices\Debugger.vb"
#Region "Microsoft.VisualBasic::4815a500fffdc82dad422f680b2f3652, Microsoft.VisualBasic.Core\ApplicationServices\Debugger.vb"
' Author:
'
@ -38,8 +38,7 @@
'
' Properties: ForceSTDError, Mute, UsingxConsole
'
' Function: __DEBUG_ECHO, Assert, BENCHMARK, (+2 Overloads) PrintException, this
' Warning
' Function: __DEBUG_ECHO, Assert, BENCHMARK, (+2 Overloads) PrintException, Warning
'
' Sub: (+2 Overloads) __DEBUG_ECHO, __INFO_ECHO, (+3 Overloads) Assertion, AttachLoggingDriver, cat
' (+3 Overloads) Echo, EchoLine, WaitOutput, WriteLine
@ -80,7 +79,7 @@ Public Module VBDebugger
<MethodImpl(MethodImplOptions.AggressiveInlining)>
Public Function die(message$, Optional failure As Assert(Of Object) = Nothing, <CallerMemberName> Optional caller$ = Nothing) As ExceptionHandle
Return New ExceptionHandle With {
.Message = message,
.message = message,
.failure = failure Or defaultAssert
}
End Function
@ -259,7 +258,7 @@ Public Module VBDebugger
<MethodImpl(MethodImplOptions.AggressiveInlining)>
<Extension>
Public Sub WriteLine(msg$, color As ConsoleColor)
My.Log4VB.WriteLine(msg, color)
My.Log4VB.Println(msg, color)
End Sub
''' <summary>
@ -372,20 +371,9 @@ Public Module VBDebugger
End Sub
<Extension> Public Sub __DEBUG_ECHO(Of T)(value As T, <CallerMemberName> Optional memberName As String = "")
Call (Scripting.InputHandler.ToString(value) & " @" & memberName).__DEBUG_ECHO
Call ($"<{memberName}> {Scripting.InputHandler.ToString(value)}").__DEBUG_ECHO
End Sub
''' <summary>
''' Returns the current function name.
''' </summary>
''' <param name="caller">
''' The caller function name, do not assign any value to this parameter! Just leave it blank.
''' </param>
''' <returns></returns>
Public Function this(<CallerMemberName> Optional caller As String = "") As String
Return caller
End Function
<Extension> Public Sub Echo(Of T)(array As IEnumerable(Of T), <CallerMemberName> Optional memberName As String = "")
Call String.Join(", ", array.Select(Function(obj) Scripting.ToString(obj)).ToArray).__DEBUG_ECHO
End Sub

View File

@ -1,87 +0,0 @@
#Region "Microsoft.VisualBasic::e4116dfe0b06870e2dcf53a489a4fb5e, ApplicationServices\Debugger\Config.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
' Class Config
'
' Properties: DefaultFile, level, mute
'
' Function: Load, Save, ToString
'
'
' /********************************************************************************/
#End Region
Imports Microsoft.VisualBasic.Serialization.JSON
Namespace ApplicationServices.Debugging
Public Class Config
Public Property level As DebuggerLevels = DebuggerLevels.On
Public Property mute As Boolean = False
Public Shared ReadOnly Property DefaultFile As String =
App.LocalData & "/debugger-config.json"
Public Shared Function Load() As Config
Try
Dim cfg As Config =
IO.File.ReadAllText(DefaultFile).LoadJSON(Of Config)
If cfg Is Nothing Then
Return New Config().Save()
Else
Return cfg
End If
Catch ex As Exception When Not DefaultFile.FileExists
Return New Config().Save()
Catch ex As Exception
Call App.LogException(ex)
' 假若是多进程的并行计算任务则可能会出现默认配置文件被占用的情况
' 这个也无能为力了 只能够放弃读取 直接使用默认的调试器参数
Return New Config
End Try
End Function
Private Function Save() As Config
Call Me.GetJson.SaveTo(DefaultFile)
Return Me
End Function
Public Overrides Function ToString() As String
Return Me.GetJson
End Function
End Class
End Namespace

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::45d782ae175d587a152a19d88a206ff7, ApplicationServices\Debugger\DebuggerArgs.vb"
#Region "Microsoft.VisualBasic::7fcd2b47d1a839220c30c326d2bb5bc1, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\DebuggerArgs.vb"
' Author:
'
@ -43,9 +43,8 @@
#End Region
Imports System.Runtime.CompilerServices
Imports Microsoft.VisualBasic.ComponentModel.DataSourceModel
Imports Microsoft.VisualBasic.Language.UnixBash
Imports Microsoft.VisualBasic.Language.UnixBash.FileSystem
Imports Microsoft.VisualBasic.My.FrameworkInternal
Imports CLI = Microsoft.VisualBasic.CommandLine.CommandLine
Namespace ApplicationServices.Debugging
@ -76,7 +75,7 @@ Namespace ApplicationServices.Debugging
''' </summary>
''' <param name="args"></param>
Private Sub __logShell(args As CLI)
Dim CLI As String = App.ExecutablePath & " " & args.CLICommandArgvs
Dim CLI As String = App.ExecutablePath & " " & args.cliCommandArgvs
Dim log As String = $"{PS1.Fedora12.ToString} {CLI}"
Dim logFile As String = App.LogErrDIR.ParentPath & "/.shells.log"
@ -176,7 +175,9 @@ Namespace ApplicationServices.Debugging
''' <param name="args">--echo on/off/all/warn/error --err &lt;path.log></param>
<Extension> Public Sub InitDebuggerEnvir(args As CLI, <CallerMemberName> Optional caller$ = Nothing)
If Not String.Equals(caller, "Main") Then
Return ' 这个调用不是从Main出发的则不设置环境了因为这个环境可能在其他的代码上面设置过了
' 这个调用不是从Main出发的则不设置环境了
' 因为这个环境可能在其他的代码上面设置过了
Return
Else
Try
Call __logShell(args)
@ -197,7 +198,8 @@ Namespace ApplicationServices.Debugging
Dim config As Config = Config.Load
If String.IsNullOrEmpty(opt) Then ' 默认的on参数
If String.IsNullOrEmpty(opt) Then
' 默认的on参数
VBDebugger.m_level = config.level
Else
Select Case opt.ToLower
@ -213,7 +215,7 @@ Namespace ApplicationServices.Debugging
VBDebugger.m_level = DebuggerLevels.Error
Case Else
VBDebugger.m_level = DebuggerLevels.On
Call Console.WriteLine($"[INFO] The debugger argument value --echo:={opt} is invalid, using default settings.")
Call $"The debugger argument value --echo:={opt} is invalid, using default settings.".Warning
End Select
End If
@ -225,35 +227,7 @@ Namespace ApplicationServices.Debugging
VBDebugger.Mute = config.mute
End If
Dim envir As Dictionary(Of String, String) = args.EnvironmentVariables
Dim disableLoadOptions As Boolean = args.GetBoolean("--load_options.disable")
' --load_options.disable 开关将会禁止所有的环境项目的设置
' 但是环境变量任然会进行加载设置
If Not disableLoadOptions AndAlso Not envir.IsNullOrEmpty Then
If envir.ContainsKey("Proxy") Then
WebServiceUtils.Proxy = envir("Proxy")
Call $"[Config] webUtils_proxy={WebServiceUtils.Proxy}".__INFO_ECHO
End If
If envir.ContainsKey("setwd") Then
App.CurrentDirectory = envir("setwd")
Call $"[Config] current_work_directory={App.CurrentDirectory}".__INFO_ECHO
End If
If envir.ContainsKey("buffer_size") Then
Call App.SetBufferSize(envir!buffer_size)
End If
End If
' /@var=name "value"
For Each var As NamedValue(Of String) In args.ParameterList
With var
If InStr(.Name, "/@var=", CompareMethod.Text) = 1 Then
Dim name$ = .Name.GetTagValue("=").Value
Call App.JoinVariable(name, .Value)
End If
End With
Next
Call config.ConfigFrameworkRuntime(args)
End Sub
End Module
End Namespace

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::70fd68fd2eafbadf80da2922e0ec0b7d, ApplicationServices\Debugger\DebuggerLevels.vb"
#Region "Microsoft.VisualBasic::70fd68fd2eafbadf80da2922e0ec0b7d, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\DebuggerLevels.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::679f37232d839b0731209665afe32b3b, ApplicationServices\Debugger\Exception\ExceptionData.vb"
#Region "Microsoft.VisualBasic::626d2b64093e22f3527641427fdc424e, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\Exception\ExceptionData.vb"
' Author:
'
@ -35,26 +35,16 @@
'
' Properties: Message, StackTrace, TypeFullName
'
' Function: CreateInstance, GetCurrentStackTrace, ToString
'
' Class StackFrame
'
' Properties: File, Line, Method
'
' Function: Parser, ToString
'
' Class Method
'
' Properties: [Module], [Namespace], Method
'
' Constructor: (+1 Overloads) Sub New
' Function: ToString
' Function: CreateFromObject, CreateInstance, Exception, GetCurrentStackTrace, getMessages
' ParseStackTrace, ToString
'
'
' /********************************************************************************/
#End Region
Imports Microsoft.VisualBasic.Text
Namespace ApplicationServices.Debugging.Diagnostics
Public Class ExceptionData
@ -63,10 +53,40 @@ Namespace ApplicationServices.Debugging.Diagnostics
Public Property Message As String()
Public Property StackTrace As StackFrame()
''' <summary>
''' Create exception object for throw exception expression
''' </summary>
''' <returns></returns>
Public Function Exception() As Exception
Return New Exception(Message.Select(Function(msg, i) $"{i}. {msg}").JoinBy(ASCII.LF)) With {
.Source = StackTrace.JoinBy(ASCII.LF)
}
End Function
Public Overrides Function ToString() As String
Return TypeFullName
End Function
Private Shared Iterator Function getMessages(ex As Exception) As IEnumerable(Of String)
Do While True
Yield ex.Message
If Not ex.InnerException Is Nothing Then
ex = ex.InnerException
Else
Exit Do
End If
Loop
End Function
Public Shared Function CreateFromObject(ex As Exception) As ExceptionData
Return New ExceptionData With {
.Message = getMessages(ex).ToArray,
.TypeFullName = ex.GetType.FullName,
.StackTrace = ParseStackTrace(ex.StackTrace)
}
End Function
Public Shared Function CreateInstance(messages$(), stackTrace$(), type$) As ExceptionData
Return New ExceptionData With {
.TypeFullName = type,
@ -77,12 +97,8 @@ Namespace ApplicationServices.Debugging.Diagnostics
}
End Function
''' <summary>
''' Parsing <see cref="Environment.StackTrace"/>, gets current stack trace information.
''' </summary>
''' <returns></returns>
Public Shared Function GetCurrentStackTrace() As StackFrame()
Return Environment.StackTrace _
Public Shared Function ParseStackTrace(stackTrace As String) As StackFrame()
Return stackTrace _
.LineTokens _
.Where(Function(s) Not s.StringEmpty) _
.Skip(3) _
@ -92,71 +108,13 @@ Namespace ApplicationServices.Debugging.Diagnostics
End Function) _
.ToArray
End Function
End Class
Public Class StackFrame
''' <summary>
''' Method call
''' Parsing <see cref="Environment.StackTrace"/>, gets current stack trace information.
''' </summary>
''' <returns></returns>
Public Property Method As Method
''' <summary>
''' The file path of the source file
''' </summary>
''' <returns></returns>
Public Property File As String
''' <summary>
''' The line number in current source <see cref="File"/>.
''' </summary>
''' <returns></returns>
Public Property Line As String
Public Overrides Function ToString() As String
Return $"{Method} at {File}:line {Line}"
End Function
Public Shared Function Parser(line As String) As StackFrame
With line.Replace("位置", "at").Replace("行号", "line")
Dim t = .StringSplit(" at ")
Dim method = t(0)
Dim location = t.ElementAtOrDefault(1)
Dim file$, lineNumber$
If Not location.StringEmpty Then
t = location.StringSplit("[:]line ")
file = t(0)
lineNumber = t(1)
Else
file = "Unknown"
lineNumber = 0
End If
Return New StackFrame With {
.Method = New Method(method),
.File = file,
.Line = lineNumber
}
End With
End Function
End Class
Public Class Method
Public Property [Namespace] As String
Public Property [Module] As String
Public Property Method As String
Sub New(s As String)
Dim t = s.Split("."c).AsList
Method = t(-1)
[Module] = t(-2)
[Namespace] = t.Take(t.Count - 2).JoinBy(".")
End Sub
Public Overrides Function ToString() As String
Return $"{[Namespace]}.{[Module]}.{Method}"
Public Shared Function GetCurrentStackTrace() As StackFrame()
Return ParseStackTrace(Environment.StackTrace)
End Function
End Class
End Namespace

View File

@ -0,0 +1,122 @@
#Region "Microsoft.VisualBasic::3c448b90b2b792689b5be21774ae4637, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\Exception\StackFrame.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
' Class StackFrame
'
' Properties: File, Line, Method
'
' Function: Parser, ToString
'
' Class Method
'
' Properties: [Module], [Namespace], Method
'
' Constructor: (+2 Overloads) Sub New
' Function: ToString
'
'
' /********************************************************************************/
#End Region
Namespace ApplicationServices.Debugging.Diagnostics
Public Class StackFrame
''' <summary>
''' Method call
''' </summary>
''' <returns></returns>
Public Property Method As Method
''' <summary>
''' The file path of the source file
''' </summary>
''' <returns></returns>
Public Property File As String
''' <summary>
''' The line number in current source <see cref="File"/>.
''' </summary>
''' <returns></returns>
Public Property Line As String
Public Overrides Function ToString() As String
Return $"{Method} at {File}:line {Line}"
End Function
Public Shared Function Parser(line As String) As StackFrame
With line.Replace("位置", "in").Replace("行号", "line")
Dim t = .StringSplit(" in ")
Dim method = t(0)
Dim location = t.ElementAtOrDefault(1)
Dim file$, lineNumber$
If Not location.StringEmpty Then
t = location.StringSplit("[:]line ")
file = t(0)
lineNumber = t(1)
Else
file = "Unknown"
lineNumber = 0
End If
Return New StackFrame With {
.Method = New Method(method),
.File = file,
.Line = lineNumber
}
End With
End Function
End Class
Public Class Method
Public Property [Namespace] As String
Public Property [Module] As String
Public Property Method As String
Sub New()
End Sub
Sub New(s As String)
Dim t = s.Split("."c).AsList
Method = t(-1)
[Module] = t(-2)
[Namespace] = t.Take(t.Count - 2).JoinBy(".")
End Sub
Public Overrides Function ToString() As String
Return $"{[Namespace]}.{[Module]}.{Method}"
End Function
End Class
End Namespace

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::94ae4e0b491c5d095a6e2a53002a395b, ApplicationServices\Debugger\VisualBasicAppException.vb"
#Region "Microsoft.VisualBasic::94ae4e0b491c5d095a6e2a53002a395b, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\Exception\VisualBasicAppException.vb"
' Author:
'

View File

@ -0,0 +1,182 @@
#Region "Microsoft.VisualBasic::7fc737e272e77ae07237e66f8bf98aab, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\HeapSizeOf.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
' Class HeapSizeOf
'
' Properties: sizeOf
'
' Function: MeasureSize, SizeOfPrimitive, StringByteSize
'
' Sub: VisitObject
'
'
' /********************************************************************************/
#End Region
Imports System.Reflection
Imports System.Runtime.CompilerServices
Imports System.Text
Imports Microsoft.VisualBasic.ComponentModel.DataSourceModel
Imports Microsoft.VisualBasic.Serialization.BinaryDumping
Namespace ApplicationServices.Debugging
''' <summary>
''' How to get object size in memory
''' </summary>
Public Class HeapSizeOf
Public ReadOnly Property sizeOf As Long
Get
Return byteSize
End Get
End Property
Dim byteSize& = 0
Dim visitor As New ObjectVisitor() With {.VisitOnlyFields = True}
Public Sub VisitObject(value As Object, type As Type, memberInfo As MemberInfo, isVisited As Boolean, isValueType As Boolean)
If value Is Nothing Then
' sizeof + 0 bytes
' exit recursive visit
Return
ElseIf isVisited Then
' add sizeof current reference
' 4 on 32-bit, 8 on 64-bit
#If X86 Then
size += 4
#Else
byteSize += 8
#End If
' exit recursive visit
ElseIf type Is GetType(String) Then
byteSize += StringByteSize(value)
' exit recursive visit
ElseIf DataFramework.IsPrimitive(type) Then
' add byte size and then exit recursive visit
byteSize += SizeOfPrimitive(type)
ElseIf isValueType Then
' is structure
' do recursive visit of this object
Call visitor.DoVisitObjectFields(value, type, AddressOf VisitObject)
Else
' add current reference
#If X86 Then
size += 4
#Else
byteSize += 8
#End If
' is class
' do recursive visit of this object
' required additional process on array
If type.IsArray Then
Call visitor.DoVisitArray(value, AddressOf VisitObject)
Else
Call visitor.DoVisitObjectFields(
obj:=value,
type:=type,
visit:=AddressOf VisitObject
)
End If
End If
End Sub
''' <summary>
''' Find out the size of a .net object
''' </summary>
''' <param name="obj"></param>
''' <returns></returns>
Public Shared Function MeasureSize(obj As Object) As Long
If obj Is Nothing Then
Return 0
Else
Dim type As Type = obj.GetType
If (Not type Is GetType(String)) AndAlso DataFramework.IsPrimitive(type) Then
Return SizeOfPrimitive(type)
ElseIf type Is GetType(String) Then
' returns the actual byte size of current string
' string in VisualBasic.NET is in unicode encoding
Return StringByteSize(obj)
ElseIf type.IsArray Then
With New HeapSizeOf
Call .visitor.DoVisitArray(
array:=obj,
visit:=AddressOf .VisitObject
)
Return .sizeOf
End With
Else
With New HeapSizeOf
Call .visitor.DoVisitObjectFields(
obj:=obj,
type:=obj.GetType,
visit:=AddressOf .VisitObject
)
Return .sizeOf
End With
End If
End If
End Function
''' <summary>
''' Returns the actual byte size of current string
''' string in VisualBasic.NET is in unicode encoding
''' </summary>
''' <param name="str"></param>
''' <returns></returns>
'''
<MethodImpl(MethodImplOptions.AggressiveInlining)>
Public Shared Function StringByteSize(str As String) As Integer
Return Encoding.Unicode.GetByteCount(str)
End Function
Public Shared Function SizeOfPrimitive(type As Type) As Integer
Select Case type
Case GetType(Single), GetType(Integer), GetType(UInt32)
Return 4
Case GetType(Double), GetType(Long), GetType(UInt64)
Return 8
Case GetType(Char), GetType(Short), GetType(UInt16)
Return 2
Case GetType(Byte), GetType(SByte), GetType(Boolean)
Return 1
Case Else
Throw New NotImplementedException(type.FullName)
End Select
End Function
End Class
End Namespace

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::b0e392b76c5a7ef2f7c5dd8334eb5080, ApplicationServices\Debugger\Logging\EventLog.vb"
#Region "Microsoft.VisualBasic::b0e392b76c5a7ef2f7c5dd8334eb5080, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\Logging\EventLog.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::b140e1247998449c2e44aee59c798206, ApplicationServices\Debugger\Logging\LogFile\LogEntry.vb"
#Region "Microsoft.VisualBasic::b140e1247998449c2e44aee59c798206, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\Logging\LogFile\LogEntry.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::99634e02bd3bb723482cefb5aa8536d9, ApplicationServices\Debugger\Logging\LogFile\LogFile.vb"
#Region "Microsoft.VisualBasic::99634e02bd3bb723482cefb5aa8536d9, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\Logging\LogFile\LogFile.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::aeac6967faadad97a2c9eea28aa83cc1, ApplicationServices\Debugger\Logging\LogFile\LogReader.vb"
#Region "Microsoft.VisualBasic::aeac6967faadad97a2c9eea28aa83cc1, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\Logging\LogFile\LogReader.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::a5a87ff1247563c2eb0d404bbf3c6774, ApplicationServices\Debugger\Logging\LogFile\MSG_TYPES.vb"
#Region "Microsoft.VisualBasic::a5a87ff1247563c2eb0d404bbf3c6774, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\Logging\LogFile\MSG_TYPES.vb"
' Author:
'

View File

@ -1,151 +0,0 @@
#Region "Microsoft.VisualBasic::2973138edf1beb9688e7277ff9156880, ApplicationServices\Debugger\NETDebugger.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
'
' /********************************************************************************/
#End Region
'Imports System.Reflection
Namespace ApplicationServices.Debugging
' ''' <summary>
' ''' .NET程序调试器
' ''' </summary>
' ''' <remarks></remarks>
'Public Class NETDebugger
' ''' <summary>
' '''
' ''' </summary>
' ''' <param name="AssemblyPath">.NET应用程序可执行文件或者包含有Main定义的dll文件</param>
' ''' <param name="argvs">调试所使用的命令行参数</param>
' ''' <returns></returns>
' ''' <remarks></remarks>
' Public Function Start(AssemblyPath As String, argvs As String()) As Integer
' AssemblyPath = FileIO.FileSystem.GetFileInfo(AssemblyPath).FullName
' Dim Assembly As System.Reflection.Assembly = System.Reflection.Assembly.LoadFile(AssemblyPath)
' Dim GetMainEntryLQuery = (From TypeEntry As System.Reflection.TypeInfo
' In Assembly.DefinedTypes
' Let EntryMain As MethodInfo = GetMainEntry(TypeEntry)
' Where EntryMain IsNot Nothing
' Select EntryMain).ToArray
' If GetMainEntryLQuery.IsNullOrEmpty Then
' Return -100
' End If
' Dim Main = GetMainEntryLQuery.First
' Return RunMain(Main, argvs)
' End Function
' ''' <summary>
' ''' 函数会递归查询
' ''' </summary>
' ''' <param name="TypeInfo"></param>
' ''' <returns></returns>
' ''' <remarks></remarks>
' Public Shared Function GetMainEntry(TypeInfo As Type) As MethodInfo
' Dim LQuery = (From Method As System.Reflection.MethodInfo
' In TypeInfo.GetMethods(BindingFlags.Public Or BindingFlags.Static)
' Where String.Equals(Method.Name, "Main", StringComparison.OrdinalIgnoreCase) AndAlso IsStandardMainReturnType(Method.ReturnType) AndAlso IsStandardMainParameterType(Method)
' Select Method).ToArray
' Return LQuery.FirstOrDefault
' End Function
' Private Shared Function IsStandardMainReturnType(Type As Type) As Boolean
' Return System.Type.Equals(Type, GetType(Void)) OrElse System.Type.Equals(Type, GetType(Integer))
' End Function
' Private Shared Function IsStandardMainParameterType(MethodInfo As MethodInfo) As Boolean
' Dim pList = MethodInfo.GetParameters
' If pList.Count > 1 Then
' Return False
' ElseIf pList.IsNullOrEmpty Then
' Return True
' End If
' Dim pTypeInfo As System.Type = pList(0).ParameterType
' Return pTypeInfo.Equals(GetType(String)) OrElse pTypeInfo.Equals(GetType(String()))
' End Function
' ''' <summary>
' ''' 启动Main函数
' ''' </summary>
' ''' <param name="Main"></param>
' ''' <param name="argvs"></param>
' ''' <returns></returns>
' ''' <remarks></remarks>
' Private Function RunMain(Main As MethodInfo, argvs As String()) As Integer
' Dim pValue As Object()
' Dim pInfo = Main.GetParameters
' If pInfo.IsNullOrEmpty Then
' pValue = New Object() {} '函数没有参数
' Else
' If pInfo(0).Equals(GetType(String)) Then
' pValue = {argvs(0)} '字符串
' Else
' pValue = {argvs} '字符串数组
' End If
' End If
' Dim result = InternalRunFunction(Main, pValue)
' If Main.ReturnType.Equals(GetType(Integer)) Then
' Return DirectCast(result, Integer)
' Else
' Return 0
' End If
' End Function
' ''' <summary>
' ''' 在终端之上打印出每一行代码
' ''' </summary>
' ''' <param name="EntryPoint"></param>
' ''' <param name="argvs"></param>
' ''' <returns></returns>
' ''' <remarks></remarks>
' Private Function InternalRunFunction(EntryPoint As MethodInfo, argvs As Object()) As Object
' End Function
'End Class
End Namespace

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::31fa0cd6ac08db181a93bd8a2614d2c9, ApplicationServices\Debugger\VisualStudioPreviews.vb"
#Region "Microsoft.VisualBasic::31fa0cd6ac08db181a93bd8a2614d2c9, Microsoft.VisualBasic.Core\ApplicationServices\Debugger\VisualStudioPreviews.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::b25e743ee7591c1e71fdaa2fd2db4d63, ApplicationServices\LanguageHelper\LanguageAttribute.vb"
#Region "Microsoft.VisualBasic::b25e743ee7591c1e71fdaa2fd2db4d63, Microsoft.VisualBasic.Core\ApplicationServices\LanguageHelper\LanguageAttribute.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::aa2ce89be28d9bbb102c6c1ba1c87a7a, ApplicationServices\LanguageHelper\LanguageHelper.vb"
#Region "Microsoft.VisualBasic::aa2ce89be28d9bbb102c6c1ba1c87a7a, Microsoft.VisualBasic.Core\ApplicationServices\LanguageHelper\LanguageHelper.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::ba85f5e7914cccfad1a4a2adcb3d9fac, ApplicationServices\LanguageHelper\StringResources.vb"
#Region "Microsoft.VisualBasic::ba85f5e7914cccfad1a4a2adcb3d9fac, Microsoft.VisualBasic.Core\ApplicationServices\LanguageHelper\StringResources.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::ab3c4c8a2c451e14dce950d548490d07, ApplicationServices\Parallel\MMFProtocol\MMFChannel.vb"
#Region "Microsoft.VisualBasic::ab3c4c8a2c451e14dce950d548490d07, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\MMFProtocol\MMFChannel.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::2393125faf83bc9ae53a165797bdd6f1, ApplicationServices\Parallel\MMFProtocol\MapStream\MSReader.vb"
#Region "Microsoft.VisualBasic::2393125faf83bc9ae53a165797bdd6f1, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\MMFProtocol\MapStream\MSReader.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::677cab0ad3137bc4e63a8cf7939e93ae, ApplicationServices\Parallel\MMFProtocol\MapStream\MSWriter.vb"
#Region "Microsoft.VisualBasic::677cab0ad3137bc4e63a8cf7939e93ae, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\MMFProtocol\MapStream\MSWriter.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::3cb2b985d6842151b781445429322b32, ApplicationServices\Parallel\MMFProtocol\Pipeline\API.vb"
#Region "Microsoft.VisualBasic::3cb2b985d6842151b781445429322b32, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\MMFProtocol\Pipeline\API.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::b6eb1b86ae83ffd1e0ceab81f5ca2159, ApplicationServices\Parallel\MMFProtocol\Pipeline\PipeBuffer.vb"
#Region "Microsoft.VisualBasic::cd750bc3d0d872fe58c7bbd4cc5ad6b9, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\MMFProtocol\Pipeline\PipeBuffer.vb"
' Author:
'
@ -56,7 +56,7 @@ Namespace Parallel.MMFProtocol.Pipeline
Sub New(raw As Byte())
Dim nameLen As Byte() = New Byte(INT32 - 1) {}
Dim p As VBInteger = Scan0
Dim p As i32 = Scan0
Call Array.ConstrainedCopy(raw, p + INT32, nameLen, Scan0, INT32)
Dim len As Integer = BitConverter.ToInt32(nameLen, Scan0)
@ -72,7 +72,7 @@ Namespace Parallel.MMFProtocol.Pipeline
Dim nameBuf As Byte() = UTF8WithoutBOM.GetBytes(Name)
Dim buffer As Byte() = New Byte(INT32 + nameBuf.Length + byteData.Length - 1) {}
Dim nameLen As Byte() = BitConverter.GetBytes(nameBuf.Length)
Dim p As VBInteger = Scan0
Dim p As i32 = Scan0
Call Array.ConstrainedCopy(nameLen, Scan0, buffer, p + nameLen.Length, nameLen.Length)
Call Array.ConstrainedCopy(nameBuf, Scan0, buffer, p + nameBuf.Length, nameBuf.Length)

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::9096a916051799d9c0ff6c7e69c083a9, ApplicationServices\Parallel\MMFProtocol\Pipeline\PipeStream.vb"
#Region "Microsoft.VisualBasic::9096a916051799d9c0ff6c7e69c083a9, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\MMFProtocol\Pipeline\PipeStream.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::b0f12490536f283a929877085408362f, ApplicationServices\Parallel\MMFProtocol\Pipeline\Pipeline.vb"
#Region "Microsoft.VisualBasic::d0d32908bf3f727a46036d0f6bfe8033, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\MMFProtocol\Pipeline\Pipeline.vb"
' Author:
'
@ -63,7 +63,7 @@ Namespace Parallel.MMFProtocol.Pipeline
Sub New(Optional port As Integer = API.PeplinePort)
_protocols = New ProtocolHandler(Me)
_netSocket = New TcpServicesSocket(port)
_netSocket.Responsehandler = AddressOf _protocols.HandleRequest
_netSocket.ResponseHandler = AddressOf _protocols.HandleRequest
Call Parallel.RunTask(AddressOf _netSocket.Run)
End Sub

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::97968f150921e7fd613c9978de939575, ApplicationServices\Parallel\MMFProtocol\ProcessLock.vb"
#Region "Microsoft.VisualBasic::97968f150921e7fd613c9978de939575, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\MMFProtocol\ProcessLock.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::aa9a6c158df2b0f6ff46e52ef7b79e28, ApplicationServices\Parallel\MMFProtocol\WorkFlow.vb"
#Region "Microsoft.VisualBasic::aa9a6c158df2b0f6ff46e52ef7b79e28, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\MMFProtocol\WorkFlow.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::8692c0dfaacf8f0e842aa47da86c0416, ApplicationServices\Parallel\OperationTimeOut.vb"
#Region "Microsoft.VisualBasic::0207a3cffa83d75a0e5040b759daa6c3, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\OperationTimeOut.vb"
' Author:
'
@ -60,7 +60,7 @@ Namespace Parallel
'''
<Extension>
Public Function OperationTimeOut(Of T, TOut)(handle As Func(Of T, TOut), [In] As T, ByRef Out As TOut, TimeOut As Double) As Boolean
Dim invoke As New __backgroundTask(Of TOut)(Function() handle([In]))
Dim invoke As New backgroundTask(Of TOut)(Function() handle([In]))
Dim i As Integer
TimeOut = TimeOut * 1000

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::afb02982ac0178b827bb2e0d041591f0, ApplicationServices\Parallel\Tasks\Actor(Of T, V).vb"
#Region "Microsoft.VisualBasic::afb02982ac0178b827bb2e0d041591f0, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Tasks\Actor(Of T, V).vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::0ad42454b00ba27b8315decee04bc742, ApplicationServices\Parallel\Tasks\AsyncHandle.vb"
#Region "Microsoft.VisualBasic::abe0e686dd1e1517f830f2fdbc7dd72f, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Tasks\AsyncHandle.vb"
' Author:
'
@ -95,7 +95,8 @@ Namespace Parallel.Tasks
''' <returns></returns>
Public Function Run() As AsyncHandle(Of TOut)
If IsCompleted Then
_Handle = Task.BeginInvoke(Nothing, Nothing) ' 假若没有执行完毕也调用的话会改变handle
' 假若没有执行完毕也调用的话会改变handle
_Handle = Task.BeginInvoke(Nothing, Nothing)
End If
Return Me

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::0cb14b35413196d04634cbeb887b9907, ApplicationServices\Parallel\Tasks\CallbackTask.vb"
#Region "Microsoft.VisualBasic::0cb14b35413196d04634cbeb887b9907, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Tasks\CallbackTask.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::f1949dc0dd55a5a4f0a9cc72039bcdbc, ApplicationServices\Parallel\Tasks\IParallelTask.vb"
#Region "Microsoft.VisualBasic::f1949dc0dd55a5a4f0a9cc72039bcdbc, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Tasks\IParallelTask.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::ace065b1c8fa32d27a4802a089772660, ApplicationServices\Parallel\Tasks\Task.vb"
#Region "Microsoft.VisualBasic::ace065b1c8fa32d27a4802a089772660, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Tasks\Task.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::956ebcd8a97a2cc25b960fde016dcc9d, ApplicationServices\Parallel\Tasks\TaskQueue.vb"
#Region "Microsoft.VisualBasic::956ebcd8a97a2cc25b960fde016dcc9d, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Tasks\TaskQueue.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::d600fc3bc5d544d05801c901e154e033, ApplicationServices\Parallel\Tasks\UpdateThread.vb"
#Region "Microsoft.VisualBasic::d600fc3bc5d544d05801c901e154e033, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Tasks\UpdateThread.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::869b09ad14c8f2c6c6f514616cbc3e82, ApplicationServices\Parallel\Tasks\__backgroundTask(Of T).vb"
#Region "Microsoft.VisualBasic::c60deb7b2b37593b3ba785850c01201e, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Tasks\__backgroundTask(Of T).vb"
' Author:
'
@ -34,7 +34,7 @@
' Delegate Function
'
'
' Class __backgroundTask
' Class backgroundTask
'
' Properties: ExecuteException, TaskHandle, Value
'
@ -61,7 +61,7 @@ Namespace Parallel.Tasks
''' <returns></returns>
Public Delegate Function IBackgroundTask(Of T)() As T
Friend Class __backgroundTask(Of T) : Inherits IParallelTask
Friend Class backgroundTask(Of T) : Inherits IParallelTask
''' <summary>
''' 获取得到任务线程执行的输出结果
@ -103,7 +103,7 @@ Namespace Parallel.Tasks
_RunningTask = False
End Sub
Public Function Start() As __backgroundTask(Of T)
Public Function Start() As backgroundTask(Of T)
If Not TaskRunning Then
_taskThread.Start()
_TaskComplete = False

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::4aab5d65673186dcf22de324c7b683d1, ApplicationServices\Parallel\Threading.vb"
#Region "Microsoft.VisualBasic::f9683810290dc0fe5b22bfab369b6ce2, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Threading.vb"
' Author:
'
@ -34,9 +34,9 @@
' Module InvokesHelper
'
' Function: Invoke
' Structure __invokeHelper
' Structure invokeHelper
'
' Function: Task
' Function: RunTask
'
'
'
@ -62,9 +62,9 @@ Namespace Parallel
''' <remarks></remarks>
<Extension> Public Function Invoke(tasks As Action(), numOfThreads As Integer) As Integer
Dim getTask As Func(Of Action, Func(Of Integer)) =
Function(task) AddressOf New __invokeHelper With {
.__task = task
}.Task
Function(task) AddressOf New invokeHelper With {
.task = task
}.RunTask
Dim invokes As Func(Of Integer)() =
LinqAPI.Exec(Of Func(Of Integer)) <= From action As Action
In tasks
@ -72,12 +72,12 @@ Namespace Parallel
Return BatchTasks.BatchTask(invokes, numOfThreads).Length
End Function
Private Structure __invokeHelper
Private Structure invokeHelper
Dim __task As Action
Dim task As Action
Public Function Task() As Integer
Call __task()
Public Function RunTask() As Integer
Call task()
Return 0
End Function
End Structure

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::d0ce60baace81f393dc0f3e4bc8ddd61, ApplicationServices\Parallel\Threads\BatchTasks.vb"
#Region "Microsoft.VisualBasic::d0ce60baace81f393dc0f3e4bc8ddd61, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Threads\BatchTasks.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::8e100823622f774acbd1bd5233f9a410, ApplicationServices\Parallel\Threads\CodeThread.vb"
#Region "Microsoft.VisualBasic::925f82e3918fced638676dee182b7a78, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Threads\CodeThread.vb"
' Author:
'
@ -53,10 +53,10 @@ Namespace Parallel.Threads
Protected ReadOnly thread As Thread
Sub New()
thread = New Thread(AddressOf __run)
thread = New Thread(AddressOf run)
End Sub
Protected MustOverride Sub __run()
Protected MustOverride Sub run()
Public Shared Function GetThread(x As CodeThread) As Thread
Return x.thread

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::19568ecf19640f9af2343dfceba0d3f4, ApplicationServices\Parallel\Threads\Groups\DataGroup.vb"
#Region "Microsoft.VisualBasic::19568ecf19640f9af2343dfceba0d3f4, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Threads\Groups\DataGroup.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::91c0c7bf05f5cc78570c51304351cd2d, ApplicationServices\Parallel\Threads\Groups\GroupAPI.vb"
#Region "Microsoft.VisualBasic::91c0c7bf05f5cc78570c51304351cd2d, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Threads\Groups\GroupAPI.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::2d841996800b3a70e80c0d50dc98e787, ApplicationServices\Parallel\Threads\LQuerySchedule\LQuerySchedule.vb"
#Region "Microsoft.VisualBasic::708662ae342ebb27208a8e66aa4233f7, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Threads\LQuerySchedule\LQuerySchedule.vb"
' Author:
'
@ -157,14 +157,14 @@ Namespace Parallel.Linq
Public Iterator Function LQuery(Of T, TOut)(inputs As IEnumerable(Of T),
task As Func(Of T, TOut),
Optional where As Func(Of T, Boolean) = Nothing,
Optional parTokens As Integer = 20000) As IEnumerable(Of TOut)
Optional partitionSize As Integer = 20000) As IEnumerable(Of TOut)
Call $"Start schedule task pool for {GetType(T).FullName} --> {GetType(TOut).FullName}".__DEBUG_ECHO
Dim buf As IEnumerable(Of Func(Of TOut())) =
If(where Is Nothing,
TaskPartitions.Partitioning(inputs, parTokens, task),
TaskPartitions.Partitioning(inputs, parTokens, task, where))
TaskPartitions.Partitioning(inputs, partitionSize, task),
TaskPartitions.Partitioning(inputs, partitionSize, task, where))
Dim LQueryInvoke = From part As Func(Of TOut())
In buf.AsParallel
Select part()
@ -190,11 +190,11 @@ Namespace Parallel.Linq
Public Iterator Function LQuery(Of T, TOut)(inputs As IEnumerable(Of T),
task As Func(Of T, TOut),
outWhere As Func(Of TOut, Boolean),
Optional parTokens As Integer = 20000) As IEnumerable(Of TOut)
Optional partitionSize As Integer = 20000) As IEnumerable(Of TOut)
Call $"Start schedule task pool for {GetType(T).FullName} --> {GetType(TOut).FullName}".__DEBUG_ECHO
Dim buf As IEnumerable(Of Func(Of TOut())) = TaskPartitions.Partitioning(inputs, parTokens, task)
Dim buf As IEnumerable(Of Func(Of TOut())) = TaskPartitions.Partitioning(inputs, partitionSize, task)
Dim LQueryInvoke = From part As Func(Of TOut())
In buf.AsParallel
Select part()

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::3be5c17214536ce52cfb48a329ec834f, ApplicationServices\Parallel\Threads\LQuerySchedule\Models.vb"
#Region "Microsoft.VisualBasic::3be5c17214536ce52cfb48a329ec834f, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Threads\LQuerySchedule\Models.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::b2b58862d64fb542fc56e70f154d98a2, ApplicationServices\Parallel\Threads\LQuerySchedule\TaskPartitions.vb"
#Region "Microsoft.VisualBasic::b2b58862d64fb542fc56e70f154d98a2, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Threads\LQuerySchedule\TaskPartitions.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::add210b8a4f87e7cf23051aaaa02d33d, ApplicationServices\Parallel\Threads\ParallelExtension.vb"
#Region "Microsoft.VisualBasic::d644612bcbf5b4839c5ed206221a2c94, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Threads\ParallelExtension.vb"
' Author:
'
@ -42,7 +42,6 @@
Imports System.Runtime.CompilerServices
Imports System.Threading
Imports Microsoft.VisualBasic.MethodsExtension
Namespace Parallel

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::428f68cffb11bf82c69327e04c881853, ApplicationServices\Parallel\Threads\ThreadPool.vb"
#Region "Microsoft.VisualBasic::428f68cffb11bf82c69327e04c881853, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Threads\ThreadPool.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::ee7085a89d6da3f3e69575abf655dfa5, ApplicationServices\Parallel\Threads\ThreadQueue.vb"
#Region "Microsoft.VisualBasic::ee7085a89d6da3f3e69575abf655dfa5, Microsoft.VisualBasic.Core\ApplicationServices\Parallel\Threads\ThreadQueue.vb"
' Author:
'
@ -124,7 +124,7 @@ Namespace Parallel
''' </summary>
Public Sub WaitQueue()
While QSolverRunning = True
Thread.Sleep(10)
Call Thread.Sleep(10)
End While
End Sub

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::2da983e326a439e3d78ee22104032cec, ApplicationServices\ServerModule.vb"
#Region "Microsoft.VisualBasic::978e12e2ef6e9729f386445dd33bf5d8, Microsoft.VisualBasic.Core\ApplicationServices\ServerModule.vb"
' Author:
'
@ -78,7 +78,7 @@ Namespace ApplicationServices
''' <param name="port">The listen port of the tcp socket.</param>
Sub New(port As Integer)
socket = New TcpServicesSocket(port, AddressOf LogException) With {
.Responsehandler = ProtocolHandler()
.ResponseHandler = ProtocolHandler()
}
End Sub

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::c8f36b0edfb7202aadaeacfc27e2b874, ApplicationServices\Terminal\InteractiveIODevice\HistoryStacks.vb"
#Region "Microsoft.VisualBasic::c8f36b0edfb7202aadaeacfc27e2b874, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\InteractiveIODevice\HistoryStacks.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::b622c2133a1e54beb409936d192a5a9c, ApplicationServices\Terminal\InteractiveIODevice\InteractiveDevice.vb"
#Region "Microsoft.VisualBasic::b622c2133a1e54beb409936d192a5a9c, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\InteractiveIODevice\InteractiveDevice.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::a596d68f21ddfe88f4f2dacfb45376f7, ApplicationServices\Terminal\InteractiveIODevice\Shell.vb"
#Region "Microsoft.VisualBasic::383b8feb02f6318617da073544d3b724, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\InteractiveIODevice\Shell.vb"
' Author:
'
@ -33,7 +33,7 @@
' Class Shell
'
' Properties: History, Quite
' Properties: dev, History, ps1, Quite, shell
'
' Constructor: (+1 Overloads) Sub New
' Sub: Run
@ -43,36 +43,59 @@
#End Region
Imports System.IO
Imports Microsoft.VisualBasic.Language
Imports Microsoft.VisualBasic.Language.UnixBash
Namespace Terminal
''' <summary>
''' Shell model for console.
''' </summary>
Public Class Shell
ReadOnly __ps1 As PS1
ReadOnly __shell As Action(Of String)
Public ReadOnly Property ps1 As PS1
Public ReadOnly Property shell As Action(Of String)
Public ReadOnly Property dev As TextReader
''' <summary>
''' Command text for exit the shell loop
'''
''' (默认的退出文本为vim的 ``:q`` 命令)
''' </summary>
''' <returns></returns>
Public Property Quite As String = ":q"
Public Property History As String = ":h"
Sub New(ps1 As PS1, exec As Action(Of String))
__ps1 = ps1
__shell = exec
''' <summary>
'''
''' </summary>
''' <param name="ps1">The commandline prompt prefix headers.</param>
''' <param name="exec">How to execute the command line input.</param>
Sub New(ps1 As PS1, exec As Action(Of String), Optional dev As TextReader = Nothing)
Me.ps1 = ps1
Me.shell = exec
Me.dev = dev Or App.StdInput
End Sub
''' <summary>
''' 执行一个配置好的命令行模型, 代码会被一直阻塞在这里
''' </summary>
Public Sub Run()
Dim cli As String
Dim cli As Value(Of String) = ""
Do While True
Call Console.Write(__ps1.ToString)
Call Console.Write(ps1.ToString)
cli = Console.ReadLine
If String.Equals(cli, Quite) Then
Exit Do
If (cli = Console.ReadLine).Trim.StringEmpty Then
Continue Do
End If
Call __shell(cli)
If cli.Value.TextEquals(Quite) Then
Exit Do
Else
Call _shell(cli)
End If
Loop
End Sub
End Class

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::c08c74a1b5e60c7ce11f1c1dfbde7b00, ApplicationServices\Terminal\InteractiveIODevice\Terminal.vb"
#Region "Microsoft.VisualBasic::c08c74a1b5e60c7ce11f1c1dfbde7b00, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\InteractiveIODevice\Terminal.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::10a854194c79e6e0a93f21577272dedb, ApplicationServices\Terminal\InteractiveIODevice\TerminalExtensions.vb"
#Region "Microsoft.VisualBasic::1dc754b47a61180b1bdf10c4c1438493, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\InteractiveIODevice\TerminalExtensions.vb"
' Author:
'
@ -38,7 +38,7 @@
'
' Properties: ConsoleHandleInvalid, CurrentSize
'
' Sub: __detects
' Sub: doEvents
'
'
'
@ -52,25 +52,28 @@ Imports Microsoft.VisualBasic.Language
Namespace Terminal
''' <summary>
''' 这个终端事件会依赖于<see cref="App.Running"/>属性值来自动退出的
''' </summary>
Public Module TerminalEvents
Public Delegate Sub ResizeEventHandle(size As Size, oldSize As Size)
Dim __resizeHandles As New List(Of ResizeEventHandle)
Dim _old As Size
Dim _eventThread As Thread
Dim resizeHandles As New List(Of ResizeEventHandle)
Dim oldSize As Size
Dim eventThread As Thread
Public ReadOnly Property CurrentSize As Size
Get
Return _old
Return oldSize
End Get
End Property
Private Sub __detects()
Private Sub doEvents()
Do While App.Running
If Console.WindowHeight <> _old.Height Then
If Console.WindowHeight <> oldSize.Height Then
RaiseEvent Resize()
ElseIf Console.WindowWidth <> _old.Width Then
ElseIf Console.WindowWidth <> oldSize.Width Then
RaiseEvent Resize()
End If
@ -85,15 +88,15 @@ Namespace Terminal
''' </summary>
Public Custom Event Resize As ResizeEventHandle
AddHandler(value As ResizeEventHandle)
If __resizeHandles.IndexOf(value) = -1 Then
__resizeHandles += value
If resizeHandles.IndexOf(value) = -1 Then
resizeHandles += value
End If
If _eventThread Is Nothing Then
If eventThread Is Nothing Then
Try
_old = New Size(Console.WindowWidth, Console.WindowHeight)
_eventThread = New Thread(AddressOf __detects)
_eventThread.Start()
oldSize = New Size(Console.WindowWidth, Console.WindowHeight)
eventThread = New Thread(AddressOf doEvents)
eventThread.Start()
Catch ex As Exception ' 可能是WindowsForm应用则在这里就忽略掉这个错误了
Call App.LogException(ex)
_ConsoleHandleInvalid = True
@ -101,23 +104,23 @@ Namespace Terminal
End If
End AddHandler
RemoveHandler(value As ResizeEventHandle)
If __resizeHandles.IndexOf(value) > -1 Then
__resizeHandles.Remove(value)
If resizeHandles.IndexOf(value) > -1 Then
resizeHandles.Remove(value)
End If
If __resizeHandles.Count = 0 Then
_eventThread.Abort()
_eventThread = Nothing
If resizeHandles.Count = 0 Then
eventThread.Abort()
eventThread = Nothing
End If
End RemoveHandler
RaiseEvent()
Dim [new] As New Size(Console.WindowWidth, Console.WindowHeight)
For Each h As ResizeEventHandle In __resizeHandles
Call h([new], _old)
For Each h As ResizeEventHandle In resizeHandles
Call h([new], oldSize)
Next
_old = [new]
oldSize = [new]
End RaiseEvent
End Event
End Module

View File

@ -0,0 +1,290 @@
#Region "Microsoft.VisualBasic::7d62185c9ec4469f9bbebbf4abff8481, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\MarkdownRender.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
' Class MarkdownRender
'
' Constructor: (+1 Overloads) Sub New
'
' Function: bufferAllIs, bufferIs
'
' Sub: DoParseSpans, DoPrint, EndSpan, Print, PrintSpans
' restoreStyle, WalkChar
'
' Class MarkdownTheme
'
' Properties: [Global], BlockQuote, Bold, CodeBlock, InlineCodeSpan
' Url
'
' Class ConsoleFontStyle
'
' Properties: BackgroundColor, ForeColor
'
' Function: Clone, CreateSpan, Equals
'
' Sub: SetConfig
'
' Class Span
'
' Properties: IsEndByNewLine, style, text
'
' Sub: Print
'
'
' /********************************************************************************/
#End Region
Imports System.Runtime.CompilerServices
Imports Microsoft.VisualBasic.Language
Imports Microsoft.VisualBasic.Language.Default
Imports Microsoft.VisualBasic.Text
Imports Microsoft.VisualBasic.Text.Parser
Namespace ApplicationServices.Terminal
''' <summary>
''' A simple markdown render on console
''' </summary>
''' <remarks>
''' 主要是渲染下面的一些元素:
'''
''' + code: 红色
''' + url: 蓝色
''' + blockquote: 灰色背景色
''' </remarks>
Public Class MarkdownRender
Shared ReadOnly defaultTheme As [Default](Of MarkdownTheme) = New MarkdownTheme With {
.[Global] = (ConsoleColor.White, ConsoleColor.Black),
.BlockQuote = (ConsoleColor.Black, ConsoleColor.Gray),
.CodeBlock = (ConsoleColor.Red, ConsoleColor.Yellow),
.InlineCodeSpan = (ConsoleColor.Red, ConsoleColor.Black),
.Url = (ConsoleColor.Blue, ConsoleColor.Black),
.Bold = (ConsoleColor.Black, ConsoleColor.Yellow),
.Italy = (ConsoleColor.Yellow, ConsoleColor.DarkGray)
}
Dim theme As MarkdownTheme
Dim markdown As CharPtr
Dim indent As Integer
Private Sub New(theme As MarkdownTheme)
Me.theme = theme
End Sub
Public Sub DoPrint(markdown$, indent%)
Me.markdown = markdown.LineTokens.JoinBy(ASCII.LF)
Me.indent = indent
Me.theme.Global.SetConfig(Me)
Me.DoParseSpans()
Me.PrintSpans()
End Sub
Private Sub DoParseSpans()
Do While Not markdown.EndRead
Call WalkChar(++markdown)
Loop
If textBuf > 0 Then
Call EndSpan(False)
End If
End Sub
Dim boldSpan As Boolean = False
Dim inlineCodespan As Boolean = False
Dim blockquote As Boolean = False
Dim italySpan As Boolean = False
Dim lastNewLine As Boolean
Dim controlBuf As New List(Of Char)
Dim textBuf As New List(Of Char)
Friend styleStack As New Stack(Of ConsoleFontStyle)
Friend currentStyle As ConsoleFontStyle
Dim spans As New List(Of Span)
Public Sub Reset()
blockquote = False
boldSpan = False
inlineCodespan = False
lastNewLine = False
italySpan = False
controlBuf *= 0
textBuf *= 0
styleStack.Clear()
spans *= 0
End Sub
Private Function bufferIs(term As String) As Boolean
If controlBuf <> term.Length Then
Return False
Else
Return controlBuf.SequenceEqual(term)
End If
End Function
Private Function bufferAllIs(c As Char) As Boolean
If controlBuf = 0 Then
Return False
Else
Return controlBuf.All(Function(b) b = c)
End If
End Function
Private Sub restoreStyle()
styleStack.Pop()
If styleStack.Count = 0 Then
Call theme.Global.SetConfig(Me)
Else
Call styleStack.Peek.SetConfig(Me)
End If
End Sub
Private Sub PrintSpans()
Dim isNewLine As Boolean = True
For Each span As Span In spans
If isNewLine Then
Console.CursorLeft = indent
End If
span.Print()
isNewLine = span.IsEndByNewLine
Next
End Sub
Private Sub EndSpan(byNewLine As Boolean)
Dim text As String = textBuf.CharString
Dim style As ConsoleFontStyle = currentStyle.Clone
If text.StartsWith("((http(s)?)|(ftp))[:]//", RegexICSng) Then
style = theme.Url
End If
If styleStack.Peek.Equals(theme.CodeBlock) Then
style.BackgroundColor = theme.CodeBlock.BackgroundColor
End If
spans += New Span With {
.style = style,
.text = text,
.IsEndByNewLine = byNewLine
}
textBuf *= 0
End Sub
Private Sub WalkChar(c As Char)
Select Case c
Case "`"c
controlBuf += c
lastNewLine = False
Case "*"c
controlBuf += c
lastNewLine = False
Case ASCII.LF
lastNewLine = True
blockquote = False
textBuf += ASCII.LF
EndSpan(True)
restoreStyle()
Case ">"c
If lastNewLine AndAlso controlBuf = 0 Then
controlBuf += c
ElseIf lastNewLine AndAlso bufferIs(">") Then
' 空白的blockquote行
Else
textBuf += c
End If
lastNewLine = False
Case " "c
lastNewLine = False
If controlBuf = 1 AndAlso controlBuf(Scan0) = ">"c Then
blockquote = True
controlBuf *= 0
theme.BlockQuote.SetConfig(Me)
textBuf += " "c
textBuf += " "c
Else
EndSpan(False)
textBuf += c
EndSpan(False)
End If
Case Else
lastNewLine = False
If bufferIs("``") Then
If inlineCodespan Then
' 结束栈
EndSpan(False)
inlineCodespan = False
restoreStyle()
Else
EndSpan(False)
inlineCodespan = True
theme.InlineCodeSpan.SetConfig(Me)
End If
controlBuf *= 0
textBuf += c
ElseIf bufferIs("**") Then
If boldSpan Then
EndSpan(False)
boldSpan = False
restoreStyle()
Else
EndSpan(False)
boldSpan = True
theme.Bold.SetConfig(Me)
End If
controlBuf *= 0
textBuf += c
Else
textBuf += c
End If
End Select
End Sub
<MethodImpl(MethodImplOptions.AggressiveInlining)>
Public Shared Sub Print(markdown As String, Optional theme As MarkdownTheme = Nothing, Optional indent% = 0)
Call New MarkdownRender(theme Or defaultTheme).DoPrint(markdown, indent)
End Sub
<MethodImpl(MethodImplOptions.AggressiveInlining)>
Public Shared Function DefaultStyleRender() As MarkdownRender
Return New MarkdownRender(defaultTheme)
End Function
End Class
End Namespace

View File

@ -0,0 +1,92 @@
Imports System.Runtime.CompilerServices
Imports Microsoft.VisualBasic.Imaging
Imports Microsoft.VisualBasic.Linq
Imports Microsoft.VisualBasic.Serialization
Namespace ApplicationServices.Terminal
Public Class MarkdownTheme
Public Property Url As ConsoleFontStyle
Public Property InlineCodeSpan As ConsoleFontStyle
Public Property CodeBlock As ConsoleFontStyle
Public Property BlockQuote As ConsoleFontStyle
Public Property [Global] As ConsoleFontStyle
Public Property Bold As ConsoleFontStyle
Public Property Italy As ConsoleFontStyle
End Class
Public Class ConsoleFontStyle
Implements IEquatable(Of ConsoleFontStyle)
Implements ICloneable(Of ConsoleFontStyle)
Public Property ForeColor As ConsoleColor = ConsoleColor.White
Public Property BackgroundColor As ConsoleColor = ConsoleColor.Black
Public Sub SetConfig(render As MarkdownRender)
Console.ForegroundColor = ForeColor
Console.BackgroundColor = BackgroundColor
render.currentStyle = Me
render.styleStack.Push(Me)
End Sub
Public Function CreateSpan(text As String) As Span
Return New Span With {
.style = Me,
.text = text
}
End Function
Public Function Clone() As ConsoleFontStyle Implements ICloneable(Of ConsoleFontStyle).Clone
Return New ConsoleFontStyle With {
.BackgroundColor = BackgroundColor,
.ForeColor = ForeColor
}
End Function
Public Overloads Function Equals(other As ConsoleFontStyle) As Boolean Implements IEquatable(Of ConsoleFontStyle).Equals
If other Is Nothing Then
Return False
Else
Return BackgroundColor = other.BackgroundColor AndAlso ForeColor = other.ForeColor
End If
End Function
Public Shared Widening Operator CType(colors As (fore As ConsoleColor, back As ConsoleColor)) As ConsoleFontStyle
Return New ConsoleFontStyle With {
.ForeColor = colors.fore,
.BackgroundColor = colors.back
}
End Operator
Public Shared Function HtmlColorCode(color As ConsoleColor) As String
Return Drawing.Color.FromName(color.ToString).ToHtmlColor
End Function
End Class
Public Class Span
Public Property text As String
Public Property style As ConsoleFontStyle
Public Property IsEndByNewLine As Boolean
<MethodImpl(MethodImplOptions.AggressiveInlining)>
Public Sub Print()
Call My.Log4VB.Print(Me)
End Sub
Public Overrides Function ToString() As String
Dim text$ = Me.text
If text.StringEmpty Then
text = "<whitespace>"
Else
text = $"""{text}"""
End If
Return style.ForeColor.DoCall(AddressOf ConsoleFontStyle.HtmlColorCode) & " " & text
End Function
End Class
End Namespace

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::2c82045a56ccf9a6611a6f19d9df9155, ApplicationServices\Terminal\PipelineCLI.vb"
#Region "Microsoft.VisualBasic::2c82045a56ccf9a6611a6f19d9df9155, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\PipelineCLI.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::87ff800f84a01faadeeb402ebf125a11, ApplicationServices\Terminal\PrintAsTable.vb"
#Region "Microsoft.VisualBasic::a275c83c8bc14c6ae8ba6fdc99769986, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\PrintAsTable.vb"
' Author:
'
@ -115,10 +115,11 @@ Namespace ApplicationServices.Terminal
Select p,
s = p.GetValue(x)) _
.ToDictionary(Function(o) o.p.Identity,
Function(o) Scripting.ToString(o.s))
Function(o)
Return Scripting.ToString(o.s)
End Function)
Dim table As List(Of String()) =
contents _
Dim table As List(Of String()) = contents _
.Select(Function(line)
Return titles.Select(Function(name) line(name)).ToArray
End Function) _
@ -134,7 +135,7 @@ Namespace ApplicationServices.Terminal
''' <summary>
''' 与函数<see cref="Print"/>所不同的是这个函数还会添加边框
''' </summary>
''' <param name="source"></param>
''' <param name="source">Each element is a row in table matrix</param>
''' <param name="dev"></param>
''' <param name="sep"></param>
<Extension>

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::2aa3a0e8fd3451b671d76bef6a1c3bbc, ApplicationServices\Terminal\STDIO__\I_ConsoleDeviceHandle.vb"
#Region "Microsoft.VisualBasic::2aa3a0e8fd3451b671d76bef6a1c3bbc, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\STDIO__\I_ConsoleDeviceHandle.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::0ecd7b473e0dc43dfa7dec39c98e5467, ApplicationServices\Terminal\STDIO__\STDIO.vb"
#Region "Microsoft.VisualBasic::746397a3e498941b6c5ecaa188fa1fb3, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\STDIO__\STDIO.vb"
' Author:
'
@ -33,7 +33,7 @@
' Module STDIO
'
' Function: __testEquals, MsgBox, scanf, ZeroFill
' Function: charTestEquals, MsgBox, scanf, ZeroFill
'
' Sub: cat, fprintf, print, printf
' Delegate Function
@ -217,20 +217,20 @@ Namespace Terminal
End If
If style = MsgBoxStyle.AbortRetryIgnore Then
If __testEquals(input, "A"c) Then
If charTestEquals(input, "A"c) Then
Return MsgBoxResult.Abort
ElseIf __testEquals(input, "R"c) Then
ElseIf charTestEquals(input, "R"c) Then
Return MsgBoxResult.Retry
ElseIf __testEquals(input, "I"c) Then
ElseIf charTestEquals(input, "I"c) Then
Return MsgBoxResult.Ignore
Else
Return MsgBoxResult.Retry
End If
ElseIf style = MsgBoxStyle.OkCancel Then
If __testEquals(input, "O"c) Then
If charTestEquals(input, "O"c) Then
Return MsgBoxResult.Ok
ElseIf __testEquals(input, "C"c) Then
ElseIf charTestEquals(input, "C"c) Then
Return MsgBoxResult.Cancel
Else
Return MsgBoxResult.Ok
@ -239,29 +239,29 @@ Namespace Terminal
Return MsgBoxResult.Ok
ElseIf style = MsgBoxStyle.RetryCancel Then
If __testEquals(input, "R"c) Then
If charTestEquals(input, "R"c) Then
Return MsgBoxResult.Retry
ElseIf __testEquals(input, "C"c) Then
ElseIf charTestEquals(input, "C"c) Then
Return MsgBoxResult.Cancel
Else
Return MsgBoxResult.Retry
End If
ElseIf style = MsgBoxStyle.YesNo Then
If __testEquals(input, "Y"c) Then
If charTestEquals(input, "Y"c) Then
Return MsgBoxResult.Yes
ElseIf __testEquals(input, "N"c) Then
ElseIf charTestEquals(input, "N"c) Then
Return MsgBoxResult.No
Else
Return MsgBoxResult.Yes
End If
ElseIf style = MsgBoxStyle.YesNoCancel Then
If __testEquals(input, "Y"c) Then
If charTestEquals(input, "Y"c) Then
Return MsgBoxResult.Yes
ElseIf __testEquals(input, "N"c) Then
ElseIf charTestEquals(input, "N"c) Then
Return MsgBoxResult.No
ElseIf __testEquals(input, "C"c) Then
ElseIf charTestEquals(input, "C"c) Then
Return MsgBoxResult.Cancel
Else
Return MsgBoxResult.Yes
@ -277,11 +277,12 @@ Namespace Terminal
''' <param name="input"></param>
''' <param name="compare">大写的</param>
''' <returns></returns>
Private Function __testEquals(input As String, compare As Char) As Boolean
Private Function charTestEquals(input As String, compare As Char) As Boolean
If String.IsNullOrEmpty(input) Then
Return False
Else
Return Asc(input.First) = Asc(compare)
End If
Return Asc(input.First) = Asc(compare)
End Function
Public Delegate Function TryParseDelegate(Of T)(str$, ByRef val As T) As Boolean
@ -303,6 +304,7 @@ Namespace Terminal
Public Function Read(Of T)(msg$, parser As TryParseDelegate(Of T), Optional _default$ = Nothing) As T
Dim line As String
Dim value As T
Do
Call Console.Write(msg)
@ -318,6 +320,7 @@ Namespace Terminal
line = _default?.ToString()
End If
Loop While Not parser(line, value)
Return value
End Function

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::9739a2dfdefc02b9fe20ca81f03b878d, ApplicationServices\Terminal\STDIO__\Shell.vb"
#Region "Microsoft.VisualBasic::0ea13648757d596ce2efe0336862a71f, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\STDIO__\Shell.vb"
' Author:
'
@ -108,8 +108,8 @@ Namespace Terminal.STDIO__
Dim Tokens = Regex.Split(CommandLine, Global.Microsoft.VisualBasic.CommandLine.SPLIT_REGX_EXPRESSION)
Dim EXE As String = Tokens.First
Dim Arguments As String = Mid$(CommandLine, Len(EXE) + 1)
Dim Process As System.Diagnostics.Process = New Process
Dim pInfo As System.Diagnostics.ProcessStartInfo = New ProcessStartInfo(EXE, Arguments)
Dim Process As New Process
Dim pInfo As New ProcessStartInfo(EXE, Arguments)
Process.StartInfo = pInfo
Process.StartInfo.WindowStyle = WindowStyle

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::6e8b09e7218d99da99b8ace3223a2777, ApplicationServices\Terminal\Utility\CBusyIndicator.vb"
#Region "Microsoft.VisualBasic::aa267559a941d77296fe1975ee1b590b, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\Utility\CBusyIndicator.vb"
' Author:
'
@ -41,7 +41,6 @@
#End Region
Imports System.Runtime.CompilerServices
Imports System.Threading
Imports Microsoft.VisualBasic.Parallel
@ -53,25 +52,28 @@ Namespace Terminal.Utility
Public Class CBusyIndicator : Implements IDisposable
Dim _indicatorStyle As Char
Dim _OnRunningState As Boolean = False
Dim _TicksCount As Integer
Dim _onRunningState As Boolean = False
Dim _ticksCount As Integer
Sub New(Optional IndicatorStyle As Char = "."c, Optional _start As Boolean = False, Optional Ticks As Integer = -1)
_indicatorStyle = IndicatorStyle
If _start Then Call Start(Ticks)
Sub New(Optional indicatorStyle As Char = "."c, Optional start As Boolean = False, Optional ticks As Integer = -1)
_indicatorStyle = indicatorStyle
If start Then
Call Me.Start(ticks)
End If
End Sub
Private Sub DoEvents()
Do While _OnRunningState = True
Do While _onRunningState = True
Call Thread.Sleep(1000)
Call STDIO.Write(_indicatorStyle)
If _TicksCount > 0 Then
_TicksCount -= 1
If _ticksCount > 0 Then
_ticksCount -= 1
Else
If _TicksCount <> -1 Then
_OnRunningState = False
If _ticksCount <> -1 Then
_onRunningState = False
End If
End If
Loop
@ -83,18 +85,18 @@ Namespace Terminal.Utility
''' <param name="Ticks">The total ticking counts of the indicator, Unit is [second].</param>
''' <remarks></remarks>
Public Sub Start(Optional Ticks As Integer = -1)
If _OnRunningState = True Then
If _onRunningState = True Then
Return
End If
_TicksCount = Ticks
_OnRunningState = True
_ticksCount = Ticks
_onRunningState = True
Call RunTask(AddressOf DoEvents)
End Sub
Public Sub [Stop]()
_OnRunningState = False
_onRunningState = False
End Sub
#Region "IDisposable Support"
@ -105,7 +107,7 @@ Namespace Terminal.Utility
If Not Me.disposedValue Then
If disposing Then
' TODO: dispose managed state (managed objects).
_OnRunningState = False
_onRunningState = False
End If
' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::a327073d8c1912fb6d47e38285e938b0, ApplicationServices\Terminal\Utility\ConsolePasswordInput.vb"
#Region "Microsoft.VisualBasic::a327073d8c1912fb6d47e38285e938b0, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\Utility\ConsolePasswordInput.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::a55db275422fac8c7cd30fc5b1d99117, ApplicationServices\Terminal\Utility\EventProc.vb"
#Region "Microsoft.VisualBasic::c8b2331b708aeb685fc608df50947246, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\Utility\EventProc.vb"
' Author:
'
@ -74,7 +74,7 @@ Namespace Terminal.Utility
Dim delta As Integer
Dim tag As String
Dim out As StreamWriter
Dim current As VBInteger = 0
Dim current As i32 = 0
''' <summary>
'''
@ -85,9 +85,7 @@ Namespace Terminal.Utility
Sub New(n As Integer, <CallerMemberName> Optional tag As String = "", Optional out As StreamWriter = Nothing)
Me.Capacity = n
Me.tag = tag
Me.out = If(out Is Nothing,
New StreamWriter(Console.OpenStandardOutput),
out)
Me.out = out Or App.StdOut
If String.IsNullOrEmpty(Me.tag) Then
Me.tag = vbTab

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::022c48ff60aa11fbd66b2c657c58ba1c, ApplicationServices\Terminal\Utility\ManualPages.vb"
#Region "Microsoft.VisualBasic::022c48ff60aa11fbd66b2c657c58ba1c, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\Utility\ManualPages.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::cb989a65864302229727d204bec99e19, ApplicationServices\Terminal\ProgressBar\AbstractBar.vb"
#Region "Microsoft.VisualBasic::cb989a65864302229727d204bec99e19, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\Utility\ProgressBar\AbstractBar.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::add5e7662691a588b501cb9803aff443, ApplicationServices\Terminal\ProgressBar\AnimatedBar.vb"
#Region "Microsoft.VisualBasic::add5e7662691a588b501cb9803aff443, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\Utility\ProgressBar\AnimatedBar.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::ed83e7b7feb6cc4ee61e7cc071105a28, ApplicationServices\Terminal\ProgressBar\Program.vb"
#Region "Microsoft.VisualBasic::ed83e7b7feb6cc4ee61e7cc071105a28, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\Utility\ProgressBar\Program.vb"
' Author:
'

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::62654a088843804f9eb38fd9f0772359, ApplicationServices\Terminal\ProgressBar\ProgressBar.vb"
#Region "Microsoft.VisualBasic::70e68318cf1bdf1b9675d9786ea4858e, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\Utility\ProgressBar\ProgressBar.vb"
' Author:
'
@ -60,6 +60,7 @@
Imports System.Drawing
Imports System.Runtime.CompilerServices
Imports Microsoft.VisualBasic.Language.Default
Imports Microsoft.VisualBasic.My.FrameworkInternal
Imports Microsoft.VisualBasic.Serialization.JSON
Namespace Terminal.ProgressBar
@ -124,7 +125,7 @@ Namespace Terminal.ProgressBar
''' </remarks>
Public Shared Function DefaultTheme() As [Default](Of ColorTheme)
Return New [Default](Of ColorTheme) With {
.Value = [Default](),
.value = [Default](),
.assert = Function(t)
Return DirectCast(t, ColorTheme).IsEmpty
End Function
@ -150,6 +151,8 @@ Namespace Terminal.ProgressBar
''' <remarks>
''' http://www.cnblogs.com/masonlu/p/4668232.html
''' </remarks>
'''
<FrameworkConfig(ProgressBar.TerminalProgressBarEnvironmentConfigName)>
Public Class ProgressBar : Inherits AbstractBar
Implements IDisposable
@ -165,6 +168,11 @@ Namespace Terminal.ProgressBar
Shared disabled As Boolean
''' <summary>
''' If this global value is not null, then set y value in constructor will be disabled.
''' </summary>
Shared pinnedTop As Integer?
Public Shared Property Enable As Boolean
Get
Return Not disabled
@ -174,8 +182,15 @@ Namespace Terminal.ProgressBar
End Set
End Property
Friend Const TerminalProgressBarEnvironmentConfigName$ = "progress_bar"
Shared Sub New()
disabled = App.GetVariable("progress_bar").TextEquals(NameOf(disabled))
disabled = App.GetVariable(TerminalProgressBarEnvironmentConfigName).TextEquals(NameOf(disabled))
' The progress bar is also be disable in internal pipeline mode
If App.GetVariable(name:=FlagInternalPipeline).ParseBoolean = True Then
disabled = True
End If
End Sub
''' <summary>
@ -194,6 +209,10 @@ Namespace Terminal.ProgressBar
Me.theme = theme Or ColorTheme.DefaultTheme
Me.y = Y
If Not pinnedTop Is Nothing Then
Me.y = pinnedTop
End If
If Not disabled Then
AddHandler TerminalEvents.Resize, AddressOf consoleWindowResize
@ -310,6 +329,18 @@ Namespace Terminal.ProgressBar
End If
End Sub
Public Shared Sub ClearPinnedTop()
pinnedTop = Nothing
End Sub
Public Shared Sub PinTop(top As Integer)
pinnedTop = top
End Sub
Public Shared Function GetCurrentConsoleTop() As Integer
Return Console.CursorTop
End Function
#Region "IDisposable Support"
Private disposedValue As Boolean ' To detect redundant calls
@ -411,6 +442,14 @@ Namespace Terminal.ProgressBar
Return Me.GetJson
End Function
Shared ReadOnly NaN As Double = New TimeSpan(
days:=9999999,' 10658576,
hours:=23,
minutes:=59,
seconds:=59,
milliseconds:=59
).TotalMilliseconds
''' <summary>
'''
''' </summary>
@ -427,6 +466,12 @@ Namespace Terminal.ProgressBar
Dim lefts = (1 - cur) / d ' lefts = 100% - currents
Dim time = lefts * Elapsed
' System.OverflowException: TimeSpan overflowed because the duration is too long.
If time > NaN Then
time = NaN
End If
Dim estimates = TimeSpan.FromMilliseconds(time)
Return estimates
End Function

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::e93d47961896d9fcaad122fc7e9c01ed, ApplicationServices\Terminal\ProgressBar\SwayBar.vb"
#Region "Microsoft.VisualBasic::048f32846f78aa68beea6ea3aad8aab0, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\Utility\ProgressBar\SwayBar.vb"
' Author:
'
@ -46,7 +46,7 @@
'
' Function: buildBlankPointer
'
' Sub: [Step], ClearBar, PlacePointer
' Sub: (+2 Overloads) [Step], ClearBar, PlacePointer
'
'
' /********************************************************************************/
@ -126,6 +126,10 @@ Namespace Terminal.ProgressBar
''' prints the progress bar acorrding to pointers and current direction
''' </summary>
Public Overrides Sub [Step]()
Call [Step](message:="")
End Sub
Public Overloads Sub [Step](message As String)
If currdir = direction.right Then
PlacePointer(counter, pointer.Length)
counter += 1
@ -142,7 +146,13 @@ Namespace Terminal.ProgressBar
End If
End If
Call Console.Write(bar & vbCr)
message = bar & message
If message.Length > Console.WindowWidth Then
message = Mid(message, 1, Console.WindowWidth - 15) & "..."
End If
Call Console.Write(message & vbCr)
End Sub
End Class
End Namespace

View File

@ -0,0 +1,149 @@
#Region "Microsoft.VisualBasic::ba5a42b26cebb753302fe07afddec2fb, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\xConsole\Comparer.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
' Class Comparer
'
' Constructor: (+3 Overloads) Sub New
' Function: Find
'
'
' /********************************************************************************/
#End Region
Namespace Terminal.xConsole
#Region "COMPARER 💻"
''' <summary>
''' This can compute the input then return back the most appropriate word.
''' </summary>
Public Class Comparer
''' <summary>
''' This is the word to find
''' </summary>
Public Word As String = String.Empty
''' <summary>
''' Descrizione
''' </summary>
Public Description As String = String.Empty
''' <summary>
''' Init to 0!
''' </summary>
Private Points As Integer = 0
''' <summary>
''' Initliaze a new instance
''' </summary>
''' <param name="w">The word to find</param>
''' <param name="p">It's should be 0</param>
Public Sub New(w As String, p As Integer)
Word = w
Points = p
End Sub
''' <summary>
''' Initliaze a new instance
''' </summary>
''' <param name="w">The word to find</param>
Public Sub New(w As String)
Word = w
Points = 0
End Sub
''' <summary>
''' Initliaze a new instance
''' </summary>
''' <param name="w">The word to find</param>
''' <param name="desc">Description (do nothing)</param>
Public Sub New(w As String, desc As String)
Word = w
Description = desc
End Sub
''' <summary>
''' Find a word from an input abbreviation (es n > name)
''' </summary>
''' <returns></returns>
Public Overloads Shared Function Find(abbr As String, ByRef Words As List(Of Comparer)) As String
Dim Result As String = String.Empty
Dim Best As Integer = 0
Dim c As Integer = 0
While Words.Count > c AndAlso Words(c) IsNot Nothing
Dim word = Words(c)
If abbr = word.Word Then
Result = abbr
Exit While
End If
For i As Integer = 0 To abbr.Length - 1
If abbr.Length < word.Word.Length AndAlso abbr(i) = word.Word(i) Then
word.Points += 1
Else
word.Points = 0
Exit For
End If
Next
If word.Points > Best Then
Best = word.Points
End If
c += 1
End While
' End while
Dim n As Integer = 0
For Each word As Comparer In Words
If word.Points = Best AndAlso word.Points > 0 Then
Result = word.Word
If System.Threading.Interlocked.Increment(n) > 1 Then
Result = String.Empty
End If
End If
Next
Return Result
End Function
End Class
'////////////////////////////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////////////////////////////
#End Region
End Namespace

View File

@ -0,0 +1,68 @@
#Region "Microsoft.VisualBasic::08920a87692c09624918fe290bdd11a1, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\xConsole\CoolWriteSettings.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
' Class CoolWriteSettings
'
' Properties: CoolWriting, CoolWritingDelay, CWRDDelay
'
' Constructor: (+1 Overloads) Sub New
'
'
' /********************************************************************************/
#End Region
Namespace Terminal.xConsole
Public NotInheritable Class CoolWriteSettings
''' <summary>
''' Gradual typing the output into console
''' </summary>
Public Shared Property CoolWriting As Boolean = False
''' <summary>
''' Write speed
''' </summary>
Public Shared Property CoolWritingDelay As Integer = 8
''' <summary>
''' Set the delay when write a new line or dots. (Default = 200).
''' </summary>
Public Shared Property CWRDDelay As Integer = 280
Private Sub New()
End Sub
End Class
End Namespace

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::4efecaebf76db9799527811db18dd578, ApplicationServices\Terminal\xConsole\Helpers.vb"
#Region "Microsoft.VisualBasic::48ab17311b3ed47c9fd117423a9c1d25, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\xConsole\Helpers.vb"
' Author:
'
@ -57,7 +57,7 @@
Imports System.Drawing
Imports System.Runtime.InteropServices
Namespace Terminal
Namespace Terminal.xConsole
''' <summary>
''' Console helper. http://blogs.microsoft.co.il/blogs/pavely/archive/2009/07/23/changing-console-fonts.aspx

View File

@ -0,0 +1,159 @@
#Region "Microsoft.VisualBasic::6b2a995592ac29c3908c6d5929d38511, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\xConsole\Spinner.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
' Class Spinner
'
' Constructor: (+2 Overloads) Sub New
'
' Function: Turn
'
' Sub: Break, Run, RunTask
'
'
' /********************************************************************************/
#End Region
Imports System.Drawing
Imports System.Threading
Namespace Terminal.xConsole
#Region "SPINNER ⌛"
''' <summary>
''' A list of spinners for your console
''' </summary>
Public Class Spinner
Private counter As Integer = 0
Private c As Char()
''' <summary>
''' List of available spinners (you can add new)
''' </summary>
Public Spinners As New List(Of Char())() From {
New Char() {"-"c, "\"c, "|"c, "/"c},
New Char() {""c, ""c, ""c, ""c},
New Char() {""c, ""c, ""c, ""c},
New Char() {"."c, "·"c, "`"c, "·"c},
New Char() {"1"c, "2"c, "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, "9"c, "0"c}
}
''' <summary>
''' looplooplooplooplooplooplooplooplooploop[...]
''' </summary>
Private inLoop As Boolean = True
''' <summary>
''' The base string for spinning. {0} will display the spinner. COLOR is SUPPORTED! 🆒
''' </summary>
Public SpinText As String = "{0} ^gLoading^!..."
''' <summary>
''' Initialize the spinner
''' </summary>
''' <param name="i">Index of the spinner to use</param>
''' <param name="txt">Base string. `{0} show the spinner`</param>
Public Sub New(Optional i As Integer = 0, Optional txt As String = Nothing)
If Not String.IsNullOrWhiteSpace(txt) Then
SpinText = txt
End If
c = If((Spinners.Count > i), Spinners(i), Spinners(0))
End Sub
''' <summary>
''' Initialize a custom spinner
''' </summary>
''' <param name="spinner">Set a custom spinner, no size limit.</param>
Public Sub New(spinner As Char())
c = spinner
End Sub
''' <summary>
''' Breaks the spinner
''' </summary>
Public Sub Break()
inLoop = False
End Sub
Private StringSize As Integer = 0
''' <summary>
''' Turn the spin!
''' </summary>
''' <param name="time">Waiting time. Default 130 ms</param>
''' <returns>False if it has been stopped</returns>
''' <example>while(spinner.Turn());</example>
Public Function Turn(Optional time As Integer = 130) As Boolean
Dim [loop] = inLoop
If [loop] Then
counter += 1
Dim wr As String = String.Format(SpinText, c(counter Mod c.Length), "wtf?")
My.InnerQueue.AddToQueue(Sub()
StringSize = xConsole.Print(wr)
Dim left As Integer = Console.CursorLeft - StringSize
If left < 0 Then
left = 0
End If
Console.SetCursorPosition(left, Console.CursorTop)
End Sub)
Thread.Sleep(time)
Else
My.InnerQueue.AddToQueue(Sub()
Dim pos As New Point(Console.CursorLeft, Console.CursorTop)
Console.Write(New String(" "c, StringSize))
Console.SetCursorPosition(pos.X, pos.Y)
End Sub)
End If
Console.CursorVisible = Not [loop]
Return [loop]
End Function
Public Sub Run(Optional speed As Integer = 130)
Do While inLoop
Call Turn(speed)
Call Thread.Sleep(10)
Loop
End Sub
Public Sub RunTask(Optional speed As Integer = 130)
Call Parallel.RunTask(Sub() Call Run(speed))
End Sub
End Class
#End Region
End Namespace

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::a8251d66048cbc47fdba172bdaeb7f54, ApplicationServices\Terminal\xConsole\xConsole.vb"
#Region "Microsoft.VisualBasic::5195ecc2349d77440a701e938d09fbdf, Microsoft.VisualBasic.Core\ApplicationServices\Terminal\xConsole\xConsole.vb"
' Author:
'
@ -33,35 +33,13 @@
' Module xConsole
'
' Constructor: (+1 Overloads) Sub New
'
' Function: CheckNewVersion, ClearInput, ClosestConsoleColor, ConvertHexStringToByteArray, getColor
' GetConsoleWindow, (+2 Overloads) Implode, ParseLine, Print, ReadKeys
' ReadLine, RetrieveLinkerTimestamp, SetWindowPos
'
' Sub: __checkUpdates, CheckforUpdates, ClearInput, (+2 Overloads) CoolWrite, CoolWriteLine
' Credits, ListFonts, RestoreColors, SetFont, SetIcon
' SetWindowPos, Wait, Write, (+3 Overloads) WriteLine
' Class CoolWriteSettings
'
' Properties: CoolWriting, CoolWritingDelay, CWRDDelay
'
' Constructor: (+1 Overloads) Sub New
'
' Class Comparer
'
' Constructor: (+3 Overloads) Sub New
' Function: Find
'
' Class Spinner
'
' Constructor: (+2 Overloads) Sub New
'
' Function: Turn
'
' Sub: Break, Run, RunTask
'
' Function: ClearInput, ClosestConsoleColor, ConvertHexStringToByteArray, getColor, GetConsoleWindow
' (+2 Overloads) Implode, ParseLine, Print, ReadKeys, ReadLine
' SetWindowPos
'
' Sub: ClearInput, (+2 Overloads) CoolWrite, CoolWriteLine, Credits, ListFonts
' RestoreColors, SetFont, SetIcon, SetWindowPos, Wait
' Write, (+3 Overloads) WriteLine
'
'
' /********************************************************************************/
@ -80,71 +58,20 @@ Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Text.RegularExpressions
Imports System.Threading
Imports System.Xml
Imports Microsoft.VisualBasic.ApplicationServices.Development
Imports Microsoft.VisualBasic.Language
Imports sys = System.Math
Imports randf = Microsoft.VisualBasic.Math.RandomExtensions
Imports stdNum = System.Math
Namespace Terminal
Namespace Terminal.xConsole
''' <summary>
''' Allows you to color and animate the console. ~ overpowered.it ~ TheTrigger - 💸
''' </summary>
''' <remarks>http://www.codeproject.com/Tips/626856/xConsole-Project</remarks>
Public Module xConsole
#Region "STATIC COSTRUCTOR .."
Sub New()
If System.Diagnostics.Debugger.IsAttached Then
Try
If CheckForUpdatesEnabled = True Then
Call __checkUpdates()
End If
Catch generatedExceptionName As Exception
Call App.LogException(generatedExceptionName)
End Try
End If
End Sub
Private Sub __checkUpdates()
Dim key As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software", True).CreateSubKey("OverPowered")
If key.GetValue("UpdateLastCheck") Is Nothing Then
key.SetValue("UpdateLastCheck", 0)
End If
If CInt(key.GetValue("UpdateLastCheck")) < DateTime.Now.DayOfYear - 30 Then
key.SetValue("UpdateLastCheck", DateTime.Now.DayOfYear)
xConsole.CheckforUpdates()
End If
Call key.Close()
End Sub
#End Region
<HideModuleName> Public Module xConsole
#Region "COOL WRITING ✌"
Public NotInheritable Class CoolWriteSettings
Private Sub New()
End Sub
''' <summary>
''' Gradual typing the output into console
''' </summary>
Public Shared Property CoolWriting As Boolean = False
''' <summary>
''' Write speed
''' </summary>
Public Shared Property CoolWritingDelay As Integer = 8
''' <summary>
''' Set the delay when write a new line or dots. (Default = 200).
''' </summary>
Public Shared Property CWRDDelay As Integer = 280
End Class
''' <summary>
''' Gradual output animation 👍👍
''' </summary>
@ -274,7 +201,7 @@ Namespace Terminal
WriteLine(vbCr & vbTab & vbTab & "^y│" & vbTab & "^3Created by^!:" & vbTab & "^8TheTrigger^!" & vbTab & vbTab & "^y│")
WriteLine(vbCr & vbTab & vbTab & "^y│" & vbTab & "^3WebSite^!:" & vbTab & "^8overpowered.it^!" & vbTab & vbTab & "^y│")
WriteLine(vbCr & vbTab & vbTab & "^y│" & vbTab & "^3Version^!:" & vbTab & "^g{0} ^!" & vbTab & vbTab & "^y│", MyASM.Version)
WriteLine(vbCr & vbTab & vbTab & "^y│" & vbTab & "^3Build Date^!:" & vbTab & "^y{0}" & vbTab & vbTab & "^y│^!.", RetrieveLinkerTimestamp().ToShortDateString())
WriteLine(vbCr & vbTab & vbTab & "^y│" & vbTab & "^3Build Date^!:" & vbTab & "^y{0}" & vbTab & vbTab & "^y│^!.", Assembly.GetCallingAssembly().RetrieveLinkerTimestamp().ToShortDateString())
WriteLine(vbCr & vbTab & vbTab & "^8╘^r■^7=═=═=═=═=═=═=═=═=═=═=═=═=═=═=═=═=═=═=═=═=═=═=^r■^8╛^!``")
WriteLine(vbCr & vbLf)
End Sub
@ -364,7 +291,7 @@ Namespace Terminal
Dim result As New List(Of Char)()
While AscW(key = Console.ReadKey(True).KeyChar) >= 0 AndAlso
AscW(+key) <> 13
Call result.Add(key.value)
Call result.Add(key.Value)
End While
Return String.Join("", result)
@ -419,7 +346,7 @@ Namespace Terminal
Dim c As Integer = 0
Dim cList = [Enum].GetNames(GetType(ConsoleColor))
Do
c = (RDN.[Next](0, cList.Length - 1))
c = (randf.seeds.Next(0, cList.Length - 1))
Loop While c = CInt(If((Type = "*"c), Console.ForegroundColor, Console.BackgroundColor))
Return CType(c, ConsoleColor)
@ -455,7 +382,7 @@ Namespace Terminal
''' The Parser
''' </summary>
''' <param name="input">Input string</param>
Private Function Print(input As String) As Integer
Friend Function Print(input As String) As Integer
If String.IsNullOrWhiteSpace(input) Then
Return 0
End If
@ -513,218 +440,6 @@ Namespace Terminal
'////////////////////////////////////////////////////////////////////////////////////////////////
#End Region
#Region "COMPARER 💻"
''' <summary>
''' This can compute the input then return back the most appropriate word.
''' </summary>
Public Class Comparer
''' <summary>
''' This is the word to find
''' </summary>
Public Word As String = String.Empty
''' <summary>
''' Descrizione
''' </summary>
Public Description As String = String.Empty
''' <summary>
''' Init to 0!
''' </summary>
Private Points As Integer = 0
''' <summary>
''' Initliaze a new instance
''' </summary>
''' <param name="w">The word to find</param>
''' <param name="p">It's should be 0</param>
Public Sub New(w As String, p As Integer)
Word = w
Points = p
End Sub
''' <summary>
''' Initliaze a new instance
''' </summary>
''' <param name="w">The word to find</param>
Public Sub New(w As String)
Word = w
Points = 0
End Sub
''' <summary>
''' Initliaze a new instance
''' </summary>
''' <param name="w">The word to find</param>
''' <param name="desc">Description (do nothing)</param>
Public Sub New(w As String, desc As String)
Word = w
Description = desc
End Sub
''' <summary>
''' Find a word from an input abbreviation (es n > name)
''' </summary>
''' <returns></returns>
Public Overloads Shared Function Find(abbr As String, ByRef Words As List(Of Comparer)) As String
Dim Result As String = String.Empty
Dim Best As Integer = 0
Dim c As Integer = 0
While Words.Count > c AndAlso Words(c) IsNot Nothing
Dim word = Words(c)
If abbr = word.Word Then
Result = abbr
Exit While
End If
For i As Integer = 0 To abbr.Length - 1
If abbr.Length < word.Word.Length AndAlso abbr(i) = word.Word(i) Then
word.Points += 1
Else
word.Points = 0
Exit For
End If
Next
If word.Points > Best Then
Best = word.Points
End If
c += 1
End While
' End while
Dim n As Integer = 0
For Each word As Comparer In Words
If word.Points = Best AndAlso word.Points > 0 Then
Result = word.Word
If System.Threading.Interlocked.Increment(n) > 1 Then
Result = String.Empty
End If
End If
Next
Return Result
End Function
End Class
'////////////////////////////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////////////////////////////
#End Region
#Region "SPINNER ⌛"
''' <summary>
''' A list of spinners for your console
''' </summary>
Public Class Spinner
Private counter As Integer = 0
Private c As Char()
''' <summary>
''' List of available spinners (you can add new)
''' </summary>
Public Spinners As New List(Of Char())() From {
New Char() {"-"c, "\"c, "|"c, "/"c},
New Char() {""c, ""c, ""c, ""c},
New Char() {""c, ""c, ""c, ""c},
New Char() {"."c, "·"c, "`"c, "·"c},
New Char() {"1"c, "2"c, "3"c, "4"c, "5"c, "6"c, "7"c, "8"c, "9"c, "0"c}
}
''' <summary>
''' looplooplooplooplooplooplooplooplooploop[...]
''' </summary>
Private inLoop As Boolean = True
''' <summary>
''' The base string for spinning. {0} will display the spinner. COLOR is SUPPORTED! 🆒
''' </summary>
Public SpinText As String = "{0} ^gLoading^!..."
''' <summary>
''' Initialize the spinner
''' </summary>
''' <param name="i">Index of the spinner to use</param>
''' <param name="txt">Base string. `{0} show the spinner`</param>
Public Sub New(Optional i As Integer = 0, Optional txt As String = Nothing)
If Not String.IsNullOrWhiteSpace(txt) Then
SpinText = txt
End If
c = If((Spinners.Count > i), Spinners(i), Spinners(0))
End Sub
''' <summary>
''' Initialize a custom spinner
''' </summary>
''' <param name="spinner">Set a custom spinner, no size limit.</param>
Public Sub New(spinner As Char())
c = spinner
End Sub
''' <summary>
''' Breaks the spinner
''' </summary>
Public Sub Break()
inLoop = False
End Sub
Private StringSize As Integer = 0
''' <summary>
''' Turn the spin!
''' </summary>
''' <param name="time">Waiting time. Default 130 ms</param>
''' <returns>False if it has been stopped</returns>
''' <example>while(spinner.Turn());</example>
Public Function Turn(Optional time As Integer = 130) As Boolean
Dim [loop] = inLoop
If [loop] Then
counter += 1
Dim wr As String = String.Format(SpinText, c(counter Mod c.Length), "wtf?")
My.InnerQueue.AddToQueue(Sub()
StringSize = Print(wr)
Dim left As Integer = Console.CursorLeft - StringSize
If left < 0 Then
left = 0
End If
Console.SetCursorPosition(left, Console.CursorTop)
End Sub)
Thread.Sleep(time)
Else
My.InnerQueue.AddToQueue(Sub()
Dim pos As New Point(Console.CursorLeft, Console.CursorTop)
Console.Write(New String(" "c, StringSize))
Console.SetCursorPosition(pos.X, pos.Y)
End Sub)
End If
Console.CursorVisible = Not [loop]
Return [loop]
End Function
Public Sub Run(Optional speed As Integer = 130)
Do While inLoop
Call Turn(speed)
Call Thread.Sleep(10)
Loop
End Sub
Public Sub RunTask(Optional speed As Integer = 130)
Call Parallel.RunTask(Sub() Call Run(speed))
End Sub
End Class
#End Region
#Region "SET FONT / ICON ⚠"
''' <summary>
@ -781,12 +496,6 @@ Namespace Terminal
''' My ASM FILE
''' </summary>
Dim MyASM As AssemblyName = Assembly.GetAssembly(GetType(xConsole)).GetName()
''' <summary>
''' Random number Generator
''' </summary>
Dim RDN As New Random()
''' <summary>
''' This value is used when restoring the colors of the console.
''' </summary>
@ -811,21 +520,21 @@ Namespace Terminal
''' </summary>
Public ClearColorsAtEnd As Boolean = False
#End Region
#Region "THIRD PART ✅"
''' <summary>
''' Convert rgb color to ConsoleColor. From stackoverflow
''' </summary>
Private Function ClosestConsoleColor(r As Byte, g As Byte, b As Byte) As ConsoleColor
Public Function ClosestConsoleColor(r As Byte, g As Byte, b As Byte) As ConsoleColor
Dim ret As ConsoleColor = 0
Dim rr As Double = r, gg As Double = g, bb As Double = b, delta As Double = Double.MaxValue
For Each cc As ConsoleColor In [Enum].GetValues(GetType(ConsoleColor))
Dim n = [Enum].GetName(GetType(ConsoleColor), cc)
Dim c = Color.FromName(If(n = "DarkYellow", "Orange", n))
Dim t = sys.Pow(c.R - rr, 2.0) + sys.Pow(c.G - gg, 2.0) + sys.Pow(c.B - bb, 2.0)
Dim t = stdNum.Pow(c.R - rr, 2.0) + stdNum.Pow(c.G - gg, 2.0) + stdNum.Pow(c.B - bb, 2.0)
If t = 0.0 Then
Return cc
End If
@ -837,36 +546,6 @@ Namespace Terminal
Return ret
End Function
''' <summary>
''' Linker Timestamp
''' </summary>
Private Function RetrieveLinkerTimestamp() As DateTime
' from stackoverflow
Dim filePath As String = System.Reflection.Assembly.GetCallingAssembly().Location
Const c_PeHeaderOffset As Integer = 60
Const c_LinkerTimestampOffset As Integer = 8
Dim b As Byte() = New Byte(2047) {}
Dim s As System.IO.Stream = Nothing
Try
s = New System.IO.FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read)
s.Read(b, 0, 2048)
Finally
If s IsNot Nothing Then
s.Close()
End If
End Try
Dim i As Integer = System.BitConverter.ToInt32(b, c_PeHeaderOffset)
Dim secondsSince1970 As Integer = System.BitConverter.ToInt32(b, i + c_LinkerTimestampOffset)
Dim dt As New DateTime(1970, 1, 1, 0, 0, 0)
dt = dt.AddSeconds(secondsSince1970)
dt = dt.AddHours(TimeZone.CurrentTimeZone.GetUtcOffset(dt).Hours)
Return dt
End Function
''' <summary>
''' Convert String to byte array
''' </summary>
@ -887,82 +566,6 @@ Namespace Terminal
Return HexAsBytes
End Function
#End Region
#Region "CHECK FOR NEW VERSION ♻"
Public Sub CheckforUpdates()
CheckForUpdatesEnabled = False
' New version
' BACK TO THE FUTURE!? wooooooooo
' up to date
Call New Thread(Sub()
Thread.Sleep(10)
Dim data = CheckNewVersion()
If Not String.IsNullOrWhiteSpace(data("url").ToString()) Then
xConsole.WriteLine("[^mxConsole^!] ^6Current Ver: ^y{0}^! / ^6Latest: ^y{1}^!", MyASM.Version, data("ver"))
Dim compared As Integer = MyASM.Version.CompareTo(data("ver"))
If compared = -1 Then
xConsole.WriteLine("[^mxConsole^!] ^gNew version available!^!")
xConsole.WriteLine("[^mxConsole^!]^11 Download/info page: ^w{0}^!", data("url"))
ElseIf compared = 1 Then
xConsole.WriteLine("[^mxConsole^!] *y^r>>>^6" & vbNullChar & "BACK TO THE ^rFUTURE!^!*!")
Else
xConsole.WriteLine("[^mxConsole^!] ^gUp to date! :)^!")
End If
Else
xConsole.WriteLine("[^mxConsole^!] ^rCan not check for updates :/^!")
End If
End Sub).Start()
End Sub
Private Function CheckNewVersion() As Dictionary(Of String, Object)
Dim reader As XmlTextReader = Nothing
Dim data As New Dictionary(Of String, Object)()
data.Add("ver", New Version())
data.Add("url", String.Empty)
Try
Dim xmlURL As String = "http://trigger.overpowered.it/xConsole/curr_version.xml"
reader = New XmlTextReader(xmlURL)
xConsole.WriteLine("[^mxConsole^!] ^6Checking for newer version...^!")
reader.MoveToContent()
Dim elementName As String = ""
If (reader.NodeType = XmlNodeType.Element) AndAlso (reader.Name = "data") Then
While reader.Read()
If reader.NodeType = XmlNodeType.Element Then
elementName = reader.Name
Else
If (reader.NodeType = XmlNodeType.Text) AndAlso (reader.HasValue) Then
Select Case elementName
Case "version"
data("ver") = New Version(reader.Value)
Case "url"
data("url") = reader.Value
End Select
End If
End If
End While
End If
Catch generatedExceptionName As Exception
Finally
If reader IsNot Nothing Then
reader.Close()
End If
End Try
Return data
End Function
#End Region
End Module
End Namespace

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::079bb93832659dcad79f67bc008fa45b, ApplicationServices\Tools\GMailClient.vb"
#Region "Microsoft.VisualBasic::079bb93832659dcad79f67bc008fa45b, Microsoft.VisualBasic.Core\ApplicationServices\Tools\GMailClient.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::3c118018626760676a3fc9601c964582, ApplicationServices\Tools\OSVersionInfo.vb"
#Region "Microsoft.VisualBasic::3c118018626760676a3fc9601c964582, Microsoft.VisualBasic.Core\ApplicationServices\Tools\OSVersionInfo.vb"
' Author:
'

View File

@ -0,0 +1,81 @@
#Region "Microsoft.VisualBasic::63c9989b77b6b1b04de901c0e5f438ac, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Plugin\Loader.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
' Module Loader
'
' Function: GetPluginMethod
'
'
' /********************************************************************************/
#End Region
Imports System.Reflection
Namespace ApplicationServices.Plugin
Public Module Loader
''' <summary>
''' 只会查找静态方法
''' </summary>
''' <param name="assembly$"></param>
''' <param name="guid"></param>
''' <returns></returns>
Public Function GetPluginMethod(assembly$, guid As String) As MethodInfo
Dim assm As Assembly = System.Reflection.Assembly.UnsafeLoadFrom(assembly.GetFullPath)
Dim types = assm.DefinedTypes.ToArray
For Each type As TypeInfo In types
Dim methods As MethodInfo() = type.GetMethods(BindingFlags.Public Or BindingFlags.Static)
Dim pluginMethod As MethodInfo = methods _
.Where(Function(m)
Return Not m.GetCustomAttribute(Of PluginAttribute) Is Nothing
End Function) _
.FirstOrDefault(Function(m)
Return m _
.GetCustomAttributes(Of PluginAttribute) _
.Any(Function(a)
Return a.UniqueKey.TextEquals(guid)
End Function)
End Function)
If Not pluginMethod Is Nothing Then
Return pluginMethod
End If
Next
Return Nothing
End Function
End Module
End Namespace

View File

@ -0,0 +1,61 @@
#Region "Microsoft.VisualBasic::de6cfa0c844217dfe9ea5a05146b4413, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Plugin\PluginAttribute.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
' Class PluginAttribute
'
' Properties: UniqueKey
'
' Constructor: (+1 Overloads) Sub New
' Function: ToString
'
'
' /********************************************************************************/
#End Region
Namespace ApplicationServices.Plugin
<AttributeUsage(AttributeTargets.Method Or AttributeTargets.Class, AllowMultiple:=True, Inherited:=True)>
Public Class PluginAttribute : Inherits Attribute
Public ReadOnly Property UniqueKey As String
Sub New(guid As String)
UniqueKey = guid
End Sub
Public Overrides Function ToString() As String
Return UniqueKey
End Function
End Class
End Namespace

View File

@ -1,48 +1,48 @@
#Region "Microsoft.VisualBasic::342a6de1f7bc3c807986dc5a2d76b044, ApplicationServices\Tools\Resources.vb"
#Region "Microsoft.VisualBasic::342a6de1f7bc3c807986dc5a2d76b044, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Resources.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU 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 General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' /********************************************************************************/
' Summaries:
' Summaries:
' Class ResourcesSatellite
'
' Properties: FileName, MyResource, Resources
'
' Constructor: (+5 Overloads) Sub New
'
' Function: DirectLoadFrom, (+2 Overloads) GetObject, (+2 Overloads) GetStream, (+3 Overloads) GetString, LoadMy
'
' Sub: __load, __resParser
'
'
' /********************************************************************************/
' Class ResourcesSatellite
'
' Properties: FileName, MyResource, Resources
'
' Constructor: (+5 Overloads) Sub New
'
' Function: DirectLoadFrom, (+2 Overloads) GetObject, (+2 Overloads) GetStream, (+3 Overloads) GetString, LoadMy
'
' Sub: __load, __resParser
'
'
' /********************************************************************************/
#End Region
@ -54,6 +54,7 @@ Imports System.Resources
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic.Language
Imports Microsoft.VisualBasic.Linq
Imports Microsoft.VisualBasic.Text
Namespace ApplicationServices
@ -296,14 +297,14 @@ Namespace ApplicationServices
Sub New(dll As String)
FileName = FileIO.FileSystem.GetFileInfo(dll).FullName
Call __resParser()
Call resourceAssemblyParser()
End Sub
Private Sub __resParser()
Call __load(Assembly.LoadFile(FileName))
Private Sub resourceAssemblyParser()
Call Assembly.LoadFile(FileName).DoCall(AddressOf doLoad)
End Sub
Private Sub __load(assm As Assembly)
Private Sub doLoad(assm As Assembly)
#If NET_40 = 0 Then
Dim resource As Type = GetType(ExportAttribute)
Dim resourceMgr As Type = LinqAPI.DefaultFirst(Of Type) _
@ -340,7 +341,7 @@ Namespace ApplicationServices
''' <param name="my">null</param>
''' <param name="assm"></param>
Private Sub New(my As Type, assm As Assembly)
Call __load(assm)
Call doLoad(assm)
End Sub
''' <summary>

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::dd20f5bcd1d85cfbb30980c437ecdbb1, ApplicationServices\Tools\Win32\GetLastErrorAPI.vb"
#Region "Microsoft.VisualBasic::dd20f5bcd1d85cfbb30980c437ecdbb1, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Win32\GetLastErrorAPI.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::569e94a0eee2f4b49b160f19eb302c50, ApplicationServices\Tools\Win32\HardwareInfo.vb"
#Region "Microsoft.VisualBasic::569e94a0eee2f4b49b160f19eb302c50, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Win32\HardwareInfo.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::d2fb9c656753077274a4c14b6c3ef9d6, ApplicationServices\Tools\Win32\PriorityClass.vb"
#Region "Microsoft.VisualBasic::d2fb9c656753077274a4c14b6c3ef9d6, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Win32\PriorityClass.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::6dac82a5a59fa93194bba41263b84e65, ApplicationServices\Tools\Win32\TaskManager.vb"
#Region "Microsoft.VisualBasic::6dac82a5a59fa93194bba41263b84e65, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Win32\TaskManager.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::a8249973c8caf43e37764fb9bbd8e1f2, ApplicationServices\Tools\Win32\Win32API.vb"
#Region "Microsoft.VisualBasic::a8249973c8caf43e37764fb9bbd8e1f2, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Win32\Win32API.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::5fabdcf92fe163a9b8eff4cd5bd91ce1, ApplicationServices\Tools\Win32\Win32File.vb"
#Region "Microsoft.VisualBasic::5fabdcf92fe163a9b8eff4cd5bd91ce1, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Win32\Win32File.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::b43dd450ac1875ebd780ed6c399af063, ApplicationServices\Tools\Win32\WindowsServices.vb"
#Region "Microsoft.VisualBasic::b43dd450ac1875ebd780ed6c399af063, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Win32\WindowsServices.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::a52f224044e46fb7dcafc4ecf1739dbf, ApplicationServices\Tools\WinForm\ChromeUIRender.vb"
#Region "Microsoft.VisualBasic::a52f224044e46fb7dcafc4ecf1739dbf, Microsoft.VisualBasic.Core\ApplicationServices\Tools\WinForm\ChromeUIRender.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::29a9366500996532fe82cc1072f8675c, ApplicationServices\Tools\WinForm\Extensions.vb"
#Region "Microsoft.VisualBasic::29a9366500996532fe82cc1072f8675c, Microsoft.VisualBasic.Core\ApplicationServices\Tools\WinForm\Extensions.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::4bb180cca46a978033e3eabfbdcbe73e, ApplicationServices\Tools\WinForm\MockForm.vb"
#Region "Microsoft.VisualBasic::4bb180cca46a978033e3eabfbdcbe73e, Microsoft.VisualBasic.Core\ApplicationServices\Tools\WinForm\MockForm.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::4e83cbcb6c757991f46eb5759cd104d0, ApplicationServices\Tools\WinForm\SingleInstanceFormEntry.vb"
#Region "Microsoft.VisualBasic::4e83cbcb6c757991f46eb5759cd104d0, Microsoft.VisualBasic.Core\ApplicationServices\Tools\WinForm\SingleInstanceFormEntry.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::7e3b7e103b4668634dc99b2fde490ce0, ApplicationServices\Tools\WinForm\VistaSecurity.vb"
#Region "Microsoft.VisualBasic::7e3b7e103b4668634dc99b2fde490ce0, Microsoft.VisualBasic.Core\ApplicationServices\Tools\WinForm\VistaSecurity.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::ebdf46fff322a8fbaf22989b286305b2, ApplicationServices\Tools\Zip\Options.vb"
#Region "Microsoft.VisualBasic::ebdf46fff322a8fbaf22989b286305b2, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Zip\Options.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::a7764170bb2462a44609972063c01f91, ApplicationServices\Tools\Zip\StreamReader.vb"
#Region "Microsoft.VisualBasic::0efa97547e395b217c0807504d57441f, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Zip\StreamReader.vb"
' Author:
'
@ -33,7 +33,7 @@
' Module ZipStreamReader
'
' Function: LoadZipArchive
' Function: GetZipSubStream, LoadZipArchive
'
'
' /********************************************************************************/
@ -42,6 +42,7 @@
Imports System.IO
Imports System.IO.Compression
Imports System.Runtime.CompilerServices
Imports Microsoft.VisualBasic.ComponentModel.Collection
Imports Microsoft.VisualBasic.ComponentModel.DataSourceModel
Imports Microsoft.VisualBasic.Linq
@ -50,6 +51,12 @@ Namespace ApplicationServices.Zip
<HideModuleName> Public Module ZipStreamReader
''' <summary>
''' 将zip文件中的所有数据包一次性的返回给上层调用代码
''' </summary>
''' <param name="zipFile"></param>
''' <param name="takes"></param>
''' <returns></returns>
Public Iterator Function LoadZipArchive(zipFile As String, Optional takes As IEnumerable(Of String) = Nothing) As IEnumerable(Of NamedValue(Of MemoryStream))
Dim takeIndex As Index(Of String) = takes.SafeQuery.ToArray
Dim entries As IEnumerable(Of ZipArchiveEntry)
@ -87,5 +94,17 @@ Namespace ApplicationServices.Zip
Next
End Using
End Function
''' <summary>
''' 如果这个函数返回的是空值说明zip压缩文件中没有该目标
''' </summary>
''' <param name="zipFile$"></param>
''' <param name="name$"></param>
''' <returns></returns>
'''
<MethodImpl(MethodImplOptions.AggressiveInlining)>
Public Function GetZipSubStream(zipFile$, name$) As MemoryStream
Return LoadZipArchive(zipFile, {name}).FirstOrDefault
End Function
End Module
End Namespace

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::c75882c2ae2d3f489422ea4953d52775, ApplicationServices\Tools\Zip\UnZip.vb"
#Region "Microsoft.VisualBasic::c75882c2ae2d3f489422ea4953d52775, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Zip\UnZip.vb"
' Author:
'

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::d1c59b3d414151d828ccee637dc6b49d, ApplicationServices\Tools\Zip\ZipLib.vb"
#Region "Microsoft.VisualBasic::9786fc773c8c2e947aeb3f58b211a294, Microsoft.VisualBasic.Core\ApplicationServices\Tools\Zip\ZipLib.vb"
' Author:
'
@ -35,7 +35,7 @@
'
' Function: IsADirectoryEntry, IsSourceFolderZip
'
' Sub: AddToArchive, AppendZip, DirectoryArchive, FileArchive
' Sub: AddToArchive, AppendZip, DeleteItems, DirectoryArchive, FileArchive
'
'
' /********************************************************************************/
@ -47,6 +47,7 @@ Imports System.IO.Compression
Imports System.Runtime.CompilerServices
Imports Microsoft.VisualBasic.ApplicationServices
Imports Microsoft.VisualBasic.CommandLine.Reflection
Imports Microsoft.VisualBasic.ComponentModel.Collection
Imports Microsoft.VisualBasic.Language
Imports Microsoft.VisualBasic.Language.UnixBash
Imports Microsoft.VisualBasic.Scripting.MetaData
@ -195,10 +196,11 @@ Namespace ApplicationServices.Zip
'Identifies the mode we will be using - the default is Create
Dim mode As ZipArchiveMode = ZipArchiveMode.Create
'Determines if the zip file even exists
Dim archiveExists As Boolean = IO.File.Exists(archiveFullName)
Call archiveFullName.ParentPath.MkDIR
'Figures out what to do based upon our specified overwrite method
Select Case action
Case ArchiveAction.Merge
@ -260,10 +262,20 @@ Namespace ApplicationServices.Zip
End Using
End Sub
<Extension>
Public Sub DeleteItems(zip As ZipArchive, itemNames As Index(Of String))
For Each file As ZipArchiveEntry In zip.Entries.ToArray
If file.Name Like itemNames Then
Call file.Delete()
End If
Next
End Sub
<Extension>
Private Sub AppendZip(zipFile As ZipArchive, files As IEnumerable(Of String), fileOverwrite As Overwrite, compression As CompressionLevel)
For Each path As String In files
Dim fileInZip = (From f In zipFile.Entries Where f.Name = IO.Path.GetFileName(path)).FirstOrDefault()
Dim pathFileName = IO.Path.GetFileName(path)
Dim fileInZip = (From f In zipFile.Entries Where f.Name = pathFileName).FirstOrDefault()
Select Case fileOverwrite
Case Overwrite.Always
@ -274,7 +286,7 @@ Namespace ApplicationServices.Zip
End If
'Adds the file to the archive
zipFile.CreateEntryFromFile(path, IO.Path.GetFileName(path), compression)
zipFile.CreateEntryFromFile(path, pathFileName, compression)
Case Overwrite.IfNewer

View File

@ -1,4 +1,4 @@
#Region "Microsoft.VisualBasic::5a7f6e6c12029e7e628810bd183163fe, ApplicationServices\Utils.vb"
#Region "Microsoft.VisualBasic::5a7f6e6c12029e7e628810bd183163fe, Microsoft.VisualBasic.Core\ApplicationServices\Utils.vb"
' Author:
'

Some files were not shown because too many files have changed in this diff Show More