Browse Source

commit: add html code paste helper

HOME 4 years ago
parent
commit
659a595975

+ 15 - 3
EfDbCommentGenerator/EfDbCommentGenerator.csproj

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="C:\NuGetLocalRepo\ILRepack.2.0.18\build\ILRepack.props" Condition="Exists('C:\NuGetLocalRepo\ILRepack.2.0.18\build\ILRepack.props')" />
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -12,6 +13,8 @@
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -70,14 +73,23 @@
     <EmbeddedResource Include="MainForm.resx">
       <DependentUpon>MainForm.cs</DependentUpon>
     </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
     <None Include="packages.config" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
-    <PostBuildEvent>if $(ConfigurationName) == Release if not exist $(TargetDir)Packed md $(TargetDir)Packed
-if $(ConfigurationName) == Release $(SolutionDir)packages\ILRepack.2.0.12\tools\ILRepack /ndebug /out:$(TargetDir)Packed\$(TargetFileName) $(TargetPath)
-if $(ConfigurationName) == Release if exist $(TargetDir)Packed\$(TargetFileName).config del $(TargetDir)Packed\$(TargetFileName).config</PostBuildEvent>
+    <PostBuildEvent>
+      if $(ConfigurationName) == Release if not exist $(TargetDir)Packed md $(TargetDir)Packed
+      if $(ConfigurationName) == Release $(ILRepack) /ndebug /out:$(TargetDir)Packed\$(TargetFileName) $(TargetPath)
+      if $(ConfigurationName) == Release if exist $(TargetDir)Packed\$(TargetFileName).config del $(TargetDir)Packed\$(TargetFileName).config</PostBuildEvent>
   </PropertyGroup>
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('C:\NuGetLocalRepo\ILRepack.2.0.18\build\ILRepack.props')" Text="$([System.String]::Format('$(ErrorText)', 'C:\NuGetLocalRepo\ILRepack.2.0.18\build\ILRepack.props'))" />
+  </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">

+ 1 - 1
EfDbCommentGenerator/packages.config

@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="ILRepack" version="2.0.12" targetFramework="net461" />
+  <package id="ILRepack" version="2.0.18" targetFramework="net461" />
 </packages>

+ 108 - 0
MiscToolSet/MainForm.Designer.cs

@@ -28,6 +28,7 @@
         /// </summary>
         private void InitializeComponent()
         {
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
             this.PasswordHasherInputTextBox = new System.Windows.Forms.TextBox();
             this.PasswordHasherOutputTextBox = new System.Windows.Forms.TextBox();
             this.GuidGeneratorCopyAttributeButton = new System.Windows.Forms.Button();
@@ -104,6 +105,13 @@
             this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
             this.RsaKeyGenerateButton = new System.Windows.Forms.Button();
             this.RsaKeySizeUpDown = new System.Windows.Forms.NumericUpDown();
+            this.tabPage8 = new System.Windows.Forms.TabPage();
+            this.splitContainer2 = new System.Windows.Forms.SplitContainer();
+            this.InputCodeTextBox = new System.Windows.Forms.RichTextBox();
+            this.ConvertedCodeTextBox = new System.Windows.Forms.RichTextBox();
+            this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
+            this.ConvertCodeButton = new System.Windows.Forms.Button();
+            this.CopyButton = new System.Windows.Forms.Button();
             this.tabControl1.SuspendLayout();
             this.tabPage2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.BulkNewGuidUpDown)).BeginInit();
@@ -129,6 +137,12 @@
             this.splitContainer1.SuspendLayout();
             this.flowLayoutPanel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.RsaKeySizeUpDown)).BeginInit();
+            this.tabPage8.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
+            this.splitContainer2.Panel1.SuspendLayout();
+            this.splitContainer2.Panel2.SuspendLayout();
+            this.splitContainer2.SuspendLayout();
+            this.flowLayoutPanel2.SuspendLayout();
             this.SuspendLayout();
             // 
             // PasswordHasherInputTextBox
@@ -265,6 +279,7 @@
             this.tabControl1.Controls.Add(this.tabPage5);
             this.tabControl1.Controls.Add(this.tabPage6);
             this.tabControl1.Controls.Add(this.tabPage7);
+            this.tabControl1.Controls.Add(this.tabPage8);
             this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.tabControl1.Location = new System.Drawing.Point(0, 0);
             this.tabControl1.Multiline = true;
@@ -1062,6 +1077,86 @@
             0,
             0});
             // 
+            // tabPage8
+            // 
+            this.tabPage8.Controls.Add(this.splitContainer2);
+            this.tabPage8.Controls.Add(this.flowLayoutPanel2);
+            this.tabPage8.Location = new System.Drawing.Point(4, 40);
+            this.tabPage8.Name = "tabPage8";
+            this.tabPage8.Padding = new System.Windows.Forms.Padding(3);
+            this.tabPage8.Size = new System.Drawing.Size(747, 676);
+            this.tabPage8.TabIndex = 7;
+            this.tabPage8.Text = "HTML Code Paste Helper";
+            this.tabPage8.UseVisualStyleBackColor = true;
+            // 
+            // splitContainer2
+            // 
+            this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.splitContainer2.Location = new System.Drawing.Point(3, 35);
+            this.splitContainer2.Name = "splitContainer2";
+            this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
+            // 
+            // splitContainer2.Panel1
+            // 
+            this.splitContainer2.Panel1.Controls.Add(this.InputCodeTextBox);
+            // 
+            // splitContainer2.Panel2
+            // 
+            this.splitContainer2.Panel2.Controls.Add(this.ConvertedCodeTextBox);
+            this.splitContainer2.Size = new System.Drawing.Size(741, 638);
+            this.splitContainer2.SplitterDistance = 351;
+            this.splitContainer2.TabIndex = 5;
+            // 
+            // InputCodeTextBox
+            // 
+            this.InputCodeTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.InputCodeTextBox.Location = new System.Drawing.Point(0, 0);
+            this.InputCodeTextBox.Name = "InputCodeTextBox";
+            this.InputCodeTextBox.Size = new System.Drawing.Size(741, 351);
+            this.InputCodeTextBox.TabIndex = 0;
+            this.InputCodeTextBox.Text = resources.GetString("InputCodeTextBox.Text");
+            this.InputCodeTextBox.WordWrap = false;
+            // 
+            // ConvertedCodeTextBox
+            // 
+            this.ConvertedCodeTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.ConvertedCodeTextBox.Location = new System.Drawing.Point(0, 0);
+            this.ConvertedCodeTextBox.Name = "ConvertedCodeTextBox";
+            this.ConvertedCodeTextBox.Size = new System.Drawing.Size(741, 283);
+            this.ConvertedCodeTextBox.TabIndex = 1;
+            this.ConvertedCodeTextBox.Text = "";
+            this.ConvertedCodeTextBox.WordWrap = false;
+            // 
+            // flowLayoutPanel2
+            // 
+            this.flowLayoutPanel2.Controls.Add(this.ConvertCodeButton);
+            this.flowLayoutPanel2.Controls.Add(this.CopyButton);
+            this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Top;
+            this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 3);
+            this.flowLayoutPanel2.Name = "flowLayoutPanel2";
+            this.flowLayoutPanel2.Size = new System.Drawing.Size(741, 32);
+            this.flowLayoutPanel2.TabIndex = 6;
+            // 
+            // ConvertCodeButton
+            // 
+            this.ConvertCodeButton.Location = new System.Drawing.Point(3, 3);
+            this.ConvertCodeButton.Name = "ConvertCodeButton";
+            this.ConvertCodeButton.Size = new System.Drawing.Size(98, 23);
+            this.ConvertCodeButton.TabIndex = 0;
+            this.ConvertCodeButton.Text = "Convert";
+            this.ConvertCodeButton.UseVisualStyleBackColor = true;
+            this.ConvertCodeButton.Click += new System.EventHandler(this.ConvertCode_Click);
+            // 
+            // CopyButton
+            // 
+            this.CopyButton.Location = new System.Drawing.Point(107, 3);
+            this.CopyButton.Name = "CopyButton";
+            this.CopyButton.Size = new System.Drawing.Size(98, 23);
+            this.CopyButton.TabIndex = 0;
+            this.CopyButton.Text = "Copy";
+            this.CopyButton.UseVisualStyleBackColor = true;
+            this.CopyButton.Click += new System.EventHandler(this.CopyButton_Click);
+            // 
             // MainForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -1103,6 +1198,12 @@
             this.splitContainer1.ResumeLayout(false);
             this.flowLayoutPanel1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.RsaKeySizeUpDown)).EndInit();
+            this.tabPage8.ResumeLayout(false);
+            this.splitContainer2.Panel1.ResumeLayout(false);
+            this.splitContainer2.Panel2.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
+            this.splitContainer2.ResumeLayout(false);
+            this.flowLayoutPanel2.ResumeLayout(false);
             this.ResumeLayout(false);
 
         }
@@ -1185,6 +1286,13 @@
         private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
         private System.Windows.Forms.RichTextBox RsaPrivateKeyTextBox;
         private System.Windows.Forms.RichTextBox RsaPublicKeyTextBox;
+        private System.Windows.Forms.TabPage tabPage8;
+        private System.Windows.Forms.SplitContainer splitContainer2;
+        private System.Windows.Forms.RichTextBox InputCodeTextBox;
+        private System.Windows.Forms.RichTextBox ConvertedCodeTextBox;
+        private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
+        private System.Windows.Forms.Button ConvertCodeButton;
+        private System.Windows.Forms.Button CopyButton;
     }
 }
 

+ 31 - 3
MiscToolSet/MainForm.cs

@@ -1,12 +1,13 @@
-using System;
+using Microsoft.AspNet.Identity;
+using System;
 using System.CodeDom.Compiler;
 using System.IO;
 using System.Linq;
 using System.Security.Cryptography;
 using System.Text;
 using System.Text.RegularExpressions;
+using System.Web;
 using System.Windows.Forms;
-using Microsoft.AspNet.Identity;
 
 namespace MiscToolSet
 {
@@ -216,6 +217,33 @@ namespace MiscToolSet
             RsaPrivateKeyTextBox.Text = rsa.ToXmlString(true);
             RsaPublicKeyTextBox.Text = rsa.ToXmlString(false);
         }
+
+        private void ConvertCode_Click(object sender, EventArgs e)
+        {
+            //html encoding
+            // <br /> append to end of line
+            // spaces indent
+
+            ConvertedCodeTextBox.Clear();
+
+            var lines = InputCodeTextBox.Lines;
+            for (var index = 0; index < lines.Length; index++)
+            {
+                var line = lines[index];
+                var htmlEncode = HttpUtility.HtmlEncode(line);
+                var spaces = line.TakeWhile(p => p == ' ').Count();
+                ConvertedCodeTextBox.AppendText($"<span style=\"padding-left: {spaces / 2.0:00.0}em;\">{htmlEncode}</span>");
+                if (index < lines.Length - 1)
+                {
+                    ConvertedCodeTextBox.AppendText($"<br />{Environment.NewLine}");
+                }
+            }
+        }
+
+        private void CopyButton_Click(object sender, EventArgs e)
+        {
+            Clipboard.SetText(ConvertedCodeTextBox.Text);
+        }
     }
 
     internal static class CommonExtensionMetond
@@ -232,4 +260,4 @@ namespace MiscToolSet
 
         public static bool Valid(string word) => Provider.IsValidIdentifier(word);
     };
-}
+}

+ 26 - 0
MiscToolSet/MainForm.resx

@@ -117,4 +117,30 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
+  <data name="InputCodeTextBox.Text" xml:space="preserve">
+    <value>&lt;?xml version="1.0" encoding="utf-8"?&gt;
+&lt;configuration&gt;
+&lt;system.webServer&gt;
+ &lt;security&gt;
+  &lt;requestFiltering&gt;
+   &lt;fileExtensions allowUnlisted="true"&gt;
+    &lt;remove fileExtension=".cs" /&gt;
+   &lt;/fileExtensions&gt;
+  &lt;/requestFiltering&gt;
+ &lt;/security&gt;
+ &lt;rewrite&gt;
+  &lt;rules&gt;
+    &lt;rule name="RedirectGogs" stopProcessing="true" enabled="true"&gt;
+      &lt;match url="^gogs/(.*$)" /&gt;
+      &lt;action type="Redirect" redirectType="Temporary" url="https://gogs.topcl.net:8443/{R:1}"/&gt;
+    &lt;/rule&gt;
+    &lt;rule name="DefultRedirectBlog" stopProcessing="true" enabled="true"&gt;
+      &lt;match url="(.*)" /&gt;
+      &lt;action type="Redirect" redirectType="Temporary" url="https://blog.topcl.net:8443/{R:0}"/&gt;
+    &lt;/rule&gt;
+  &lt;/rules&gt;
+ &lt;/rewrite&gt;
+&lt;/system.webServer&gt;
+&lt;/configuration&gt;</value>
+  </data>
 </root>

+ 12 - 8
MiscToolSet/MiscToolSet.csproj

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\packages\ILRepack.2.0.13\build\ILRepack.props" Condition="Exists('..\packages\ILRepack.2.0.13\build\ILRepack.props')" />
+  <Import Project="C:\NuGetLocalRepo\ILRepack.2.0.18\build\ILRepack.props" Condition="Exists('C:\NuGetLocalRepo\ILRepack.2.0.18\build\ILRepack.props')" />
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -39,11 +39,12 @@
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
+      <HintPath>C:\NuGetLocalRepo\Microsoft.AspNet.Identity.Core.2.2.3\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
       <Private>True</Private>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Web" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
@@ -65,20 +66,23 @@
     <EmbeddedResource Include="MainForm.resx">
       <DependentUpon>MainForm.cs</DependentUpon>
     </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
     <None Include="packages.config" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PostBuildEvent>
+      if $(ConfigurationName) == Release if not exist $(TargetDir)Packed md $(TargetDir)Packed
+      if $(ConfigurationName) == Release $(ILRepack) /ndebug /out:$(TargetDir)Packed\$(TargetFileName) $(TargetPath) Microsoft.AspNet.Identity.Core.dll
+      if $(ConfigurationName) == Release if exist $(TargetDir)Packed\$(TargetFileName).config del $(TargetDir)Packed\$(TargetFileName).config</PostBuildEvent>
+  </PropertyGroup>
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
       <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
     </PropertyGroup>
-    <Error Condition="!Exists('..\packages\ILRepack.2.0.13\build\ILRepack.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ILRepack.2.0.13\build\ILRepack.props'))" />
+    <Error Condition="!Exists('C:\NuGetLocalRepo\ILRepack.2.0.18\build\ILRepack.props')" Text="$([System.String]::Format('$(ErrorText)', 'C:\NuGetLocalRepo\ILRepack.2.0.18\build\ILRepack.props'))" />
   </Target>
-  <PropertyGroup>
-    <PostBuildEvent>if $(ConfigurationName) == Release if not exist $(TargetDir)Packed md $(TargetDir)Packed
-if $(ConfigurationName) == Release $(SolutionDir)packages\ILRepack.2.0.13\tools\ILRepack /ndebug /out:$(TargetDir)Packed\$(TargetFileName) $(TargetPath) Microsoft.AspNet.Identity.Core.dll
-if $(ConfigurationName) == Release if exist $(TargetDir)Packed\$(TargetFileName).config del $(TargetDir)Packed\$(TargetFileName).config</PostBuildEvent>
-  </PropertyGroup>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">

+ 2 - 2
MiscToolSet/packages.config

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="ILRepack" version="2.0.13" targetFramework="net45" />
-  <package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
+  <package id="ILRepack" version="2.0.18" targetFramework="net45" />
+  <package id="Microsoft.AspNet.Identity.Core" version="2.2.3" targetFramework="net45" />
 </packages>

+ 6 - 0
NuGet.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?> 
+<configuration> 
+  <config> 
+    <add key="repositorypath" value="C:\NuGetLocalRepo" /> 
+  </config> 
+</configuration>

+ 5 - 0
SoftwareDevelopAssistantTools.sln

@@ -7,6 +7,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EfDbCommentGenerator", "EfD
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiscToolSet", "MiscToolSet\MiscToolSet.csproj", "{9A38DF9F-2A22-413A-B51B-5647DCA8F131}"
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{55728F83-E3D4-4945-95D2-6395AF6A33A1}"
+	ProjectSection(SolutionItems) = preProject
+		NuGet.config = NuGet.config
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU