From 0d8db603f1c7cc23169f59e730797afbdb8ed5ba Mon Sep 17 00:00:00 2001 From: vessel Date: Tue, 3 Dec 2019 12:34:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B1=E4=BA=8E.netcore=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E9=A2=9D=E5=A4=96=E4=B8=8B=E8=BD=BD=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E7=8E=AF=E5=A2=83,=E9=87=8D=E6=96=B0=E6=94=B9?= =?UTF-8?q?=E4=B8=BAWPF=E9=A1=B9=E7=9B=AE,=20.net=20core=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E6=94=BE=E5=85=A5=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.config | 6 + ClipOne/App.xaml => App.xaml | 0 ClipOne/App.xaml.cs => App.xaml.cs | 0 ClipOne.csproj | 191 +++++++++ ClipOne/ClipOne.ico => ClipOne.ico | Bin ClipOne.sln | 18 +- ClipOne/ClipOne.csproj | 67 ---- ClipOne/ClipOne.csproj.user | 12 - .../PublishProfiles/FolderProfile.pubxml | 15 - .../PublishProfiles/FolderProfile.pubxml.user | 6 - Properties/AssemblyInfo.cs | 55 +++ Properties/Resources.Designer.cs | 71 ++++ Properties/Resources.resx | 117 ++++++ Properties/Settings.Designer.cs | 30 ++ Properties/Settings.settings | 7 + README.md | 24 +- .../html => html}/css/classic/classic.css | 0 .../html => html}/css/material/material.css | 0 {ClipOne/html => html}/css/modern/modern.css | 0 {ClipOne/html => html}/css/stand/stand.css | 0 .../html => html}/css/striped/striped.css | 0 {ClipOne/html => html}/index.html | 0 {ClipOne/html => html}/js/jquery-3.3.1.min.js | 0 .../html => html}/js/jquery.nicescroll.min.js | 0 {ClipOne/html => html}/js/main.js | 0 {ClipOne/model => model}/ClipModel.cs | 0 {ClipOne/model => model}/ClipType.cs | 0 {ClipOne/model => model}/Config.cs | 0 {ClipOne/service => service}/ClipService.cs | 25 +- {ClipOne/service => service}/ConfigService.cs | 0 {ClipOne/util => util}/CursorHelp.cs | 0 {ClipOne/util => util}/HotKeyManager.cs | 0 util/HttpUtility.cs | 366 ++++++++++++++++++ {ClipOne/util => util}/KeyboardKit.cs | 0 {ClipOne/util => util}/WinAPIHelper.cs | 0 {ClipOne/view => view}/MainWindow.xaml | 0 {ClipOne/view => view}/MainWindow.xaml.cs | 3 +- {ClipOne/view => view}/SetHotKeyForm.xaml | 0 {ClipOne/view => view}/SetHotKeyForm.xaml.cs | 0 ...6\346\263\250\345\206\214\350\241\250.bat" | 0 40 files changed, 895 insertions(+), 118 deletions(-) create mode 100644 App.config rename ClipOne/App.xaml => App.xaml (100%) rename ClipOne/App.xaml.cs => App.xaml.cs (100%) create mode 100644 ClipOne.csproj rename ClipOne/ClipOne.ico => ClipOne.ico (100%) delete mode 100644 ClipOne/ClipOne.csproj delete mode 100644 ClipOne/ClipOne.csproj.user delete mode 100644 ClipOne/Properties/PublishProfiles/FolderProfile.pubxml delete mode 100644 ClipOne/Properties/PublishProfiles/FolderProfile.pubxml.user create mode 100644 Properties/AssemblyInfo.cs create mode 100644 Properties/Resources.Designer.cs create mode 100644 Properties/Resources.resx create mode 100644 Properties/Settings.Designer.cs create mode 100644 Properties/Settings.settings rename {ClipOne/html => html}/css/classic/classic.css (100%) rename {ClipOne/html => html}/css/material/material.css (100%) rename {ClipOne/html => html}/css/modern/modern.css (100%) rename {ClipOne/html => html}/css/stand/stand.css (100%) rename {ClipOne/html => html}/css/striped/striped.css (100%) rename {ClipOne/html => html}/index.html (100%) rename {ClipOne/html => html}/js/jquery-3.3.1.min.js (100%) rename {ClipOne/html => html}/js/jquery.nicescroll.min.js (100%) rename {ClipOne/html => html}/js/main.js (100%) rename {ClipOne/model => model}/ClipModel.cs (100%) rename {ClipOne/model => model}/ClipType.cs (100%) rename {ClipOne/model => model}/Config.cs (100%) rename {ClipOne/service => service}/ClipService.cs (95%) rename {ClipOne/service => service}/ConfigService.cs (100%) rename {ClipOne/util => util}/CursorHelp.cs (100%) rename {ClipOne/util => util}/HotKeyManager.cs (100%) create mode 100644 util/HttpUtility.cs rename {ClipOne/util => util}/KeyboardKit.cs (100%) rename {ClipOne/util => util}/WinAPIHelper.cs (100%) rename {ClipOne/view => view}/MainWindow.xaml (100%) rename {ClipOne/view => view}/MainWindow.xaml.cs (99%) rename {ClipOne/view => view}/SetHotKeyForm.xaml (100%) rename {ClipOne/view => view}/SetHotKeyForm.xaml.cs (100%) rename "ClipOne/\345\215\270\350\275\275\345\211\215\346\270\205\347\220\206\346\263\250\345\206\214\350\241\250.bat" => "\345\215\270\350\275\275\345\211\215\346\270\205\347\220\206\346\263\250\345\206\214\350\241\250.bat" (100%) diff --git a/App.config b/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ClipOne/App.xaml b/App.xaml similarity index 100% rename from ClipOne/App.xaml rename to App.xaml diff --git a/ClipOne/App.xaml.cs b/App.xaml.cs similarity index 100% rename from ClipOne/App.xaml.cs rename to App.xaml.cs diff --git a/ClipOne.csproj b/ClipOne.csproj new file mode 100644 index 0000000..c797448 --- /dev/null +++ b/ClipOne.csproj @@ -0,0 +1,191 @@ + + + + + Debug + AnyCPU + {90FB9219-A219-48DF-BD87-D8EB4FAB533E} + WinExe + ClipOne + ClipOne + v4.7.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + 7.3 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + 7.3 + prompt + MinimumRecommendedRules.ruleset + true + + + ClipOne.ico + + + + + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + + + + + + MainWindow.xaml + + + SetHotKeyForm.xaml + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + 1.0.8 + + + 1.11.17 + + + 6.0.0 + + + 12.0.3 + + + + \ No newline at end of file diff --git a/ClipOne/ClipOne.ico b/ClipOne.ico similarity index 100% rename from ClipOne/ClipOne.ico rename to ClipOne.ico diff --git a/ClipOne.sln b/ClipOne.sln index 74ee92c..3471730 100644 --- a/ClipOne.sln +++ b/ClipOne.sln @@ -3,23 +3,29 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29519.87 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClipOne", "ClipOne\ClipOne.csproj", "{AE53DEAD-B9DF-4A9F-B333-87CC8E0EB357}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClipOne", "ClipOne.csproj", "{90FB9219-A219-48DF-BD87-D8EB4FAB533E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AE53DEAD-B9DF-4A9F-B333-87CC8E0EB357}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AE53DEAD-B9DF-4A9F-B333-87CC8E0EB357}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AE53DEAD-B9DF-4A9F-B333-87CC8E0EB357}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AE53DEAD-B9DF-4A9F-B333-87CC8E0EB357}.Release|Any CPU.Build.0 = Release|Any CPU + {90FB9219-A219-48DF-BD87-D8EB4FAB533E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90FB9219-A219-48DF-BD87-D8EB4FAB533E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90FB9219-A219-48DF-BD87-D8EB4FAB533E}.Debug|x64.ActiveCfg = Debug|x64 + {90FB9219-A219-48DF-BD87-D8EB4FAB533E}.Debug|x64.Build.0 = Debug|x64 + {90FB9219-A219-48DF-BD87-D8EB4FAB533E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90FB9219-A219-48DF-BD87-D8EB4FAB533E}.Release|Any CPU.Build.0 = Release|Any CPU + {90FB9219-A219-48DF-BD87-D8EB4FAB533E}.Release|x64.ActiveCfg = Release|x64 + {90FB9219-A219-48DF-BD87-D8EB4FAB533E}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {83751E13-8308-4E53-9BA6-F74859856FA7} + SolutionGuid = {99BDCE5C-4E54-450A-A5F2-65BCBB266EC5} EndGlobalSection EndGlobal diff --git a/ClipOne/ClipOne.csproj b/ClipOne/ClipOne.csproj deleted file mode 100644 index 78d3d28..0000000 --- a/ClipOne/ClipOne.csproj +++ /dev/null @@ -1,67 +0,0 @@ - - - - WinExe - netcoreapp3.0 - true - ClipOne.App - ClipOne.ico - - - - - - - - - - - - - - - - - - 1.11.17 - - - 6.0.0 - - - 12.0.3 - - - - - - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - \ No newline at end of file diff --git a/ClipOne/ClipOne.csproj.user b/ClipOne/ClipOne.csproj.user deleted file mode 100644 index c09a093..0000000 --- a/ClipOne/ClipOne.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - - <_LastSelectedProfileId>C:\Users\xiecan\dev\.net\ClipOne\ClipOne\Properties\PublishProfiles\FolderProfile.pubxml - - - - Designer - - - - \ No newline at end of file diff --git a/ClipOne/Properties/PublishProfiles/FolderProfile.pubxml b/ClipOne/Properties/PublishProfiles/FolderProfile.pubxml deleted file mode 100644 index 5a329f9..0000000 --- a/ClipOne/Properties/PublishProfiles/FolderProfile.pubxml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - FileSystem - Release - Any CPU - netcoreapp3.0 - bin\Release\netcoreapp3.0\publish\ - win-x64 - true - - \ No newline at end of file diff --git a/ClipOne/Properties/PublishProfiles/FolderProfile.pubxml.user b/ClipOne/Properties/PublishProfiles/FolderProfile.pubxml.user deleted file mode 100644 index 312c6e3..0000000 --- a/ClipOne/Properties/PublishProfiles/FolderProfile.pubxml.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8ce48e5 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("ClipOne")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ClipOne")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +//若要开始生成可本地化的应用程序,请设置 +//.csproj 文件中的 CultureYouAreCodingWith +//例如,如果您在源文件中使用的是美国英语, +//使用的是美国英语,请将 设置为 en-US。 然后取消 +//对以下 NeutralResourceLanguage 特性的注释。 更新 +//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //主题特定资源词典所处位置 + //(未在页面中找到资源时使用, + //或应用程序资源字典中找到时使用) + ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 + //(未在页面中找到资源时使用, + //、应用程序或任何主题专用资源字典中找到时使用) +)] + + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..1d87582 --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace ClipOne.Properties +{ + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ClipOne.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 覆盖当前线程的 CurrentUICulture 属性 + /// 使用此强类型的资源类的资源查找。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..c76474d --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ClipOne.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index b09d68b..227a00d 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,27 @@ # ClipOne -`ClipOne`是一个剪切板增强工具,提供简洁高效的复制增强功能,改进UI界面。 -# 主要功能 +`ClipOne`是一个小巧绿色的剪切板增强工具,提供简洁高效的复制增强功能. # 使用 -默认通过alt+v呼出界面,可在托盘图标处自定义 - +- 呼出 +>默认通过alt+v呼出界面,可在托盘图标处自定义热键 +- 换肤 +> 主要界面基于html5+css开发,可以通过自定义CSS文件来自定义主题,内置5种不同风格的皮肤 +- 连续粘贴 +> 按住Shift键选择起始项则可以根据选择访问按顺序粘贴 +- 删除 +> 选中后按Del键删除该项 +- 搜索 +> 按Ctrl+F呼出搜索栏 +- 快捷键 +> 呼出主界面后,按空格默认选择第1个,按回车默认选择第2个(即上一个),前35个可以通过按后面显示的快捷键快速选择,ESC键隐藏界面 # 环境 -- windows 10 -- .NET Core Runtime 3.0 -- .NET Core Desktop Runtime 3.0 +- windows10 1803及以上 # 支持格式 - QQ富文本 - 微信富文本 -- html(包括GIF) +- 图片(包括GIF) +- html - 文件 - 普通文本 diff --git a/ClipOne/html/css/classic/classic.css b/html/css/classic/classic.css similarity index 100% rename from ClipOne/html/css/classic/classic.css rename to html/css/classic/classic.css diff --git a/ClipOne/html/css/material/material.css b/html/css/material/material.css similarity index 100% rename from ClipOne/html/css/material/material.css rename to html/css/material/material.css diff --git a/ClipOne/html/css/modern/modern.css b/html/css/modern/modern.css similarity index 100% rename from ClipOne/html/css/modern/modern.css rename to html/css/modern/modern.css diff --git a/ClipOne/html/css/stand/stand.css b/html/css/stand/stand.css similarity index 100% rename from ClipOne/html/css/stand/stand.css rename to html/css/stand/stand.css diff --git a/ClipOne/html/css/striped/striped.css b/html/css/striped/striped.css similarity index 100% rename from ClipOne/html/css/striped/striped.css rename to html/css/striped/striped.css diff --git a/ClipOne/html/index.html b/html/index.html similarity index 100% rename from ClipOne/html/index.html rename to html/index.html diff --git a/ClipOne/html/js/jquery-3.3.1.min.js b/html/js/jquery-3.3.1.min.js similarity index 100% rename from ClipOne/html/js/jquery-3.3.1.min.js rename to html/js/jquery-3.3.1.min.js diff --git a/ClipOne/html/js/jquery.nicescroll.min.js b/html/js/jquery.nicescroll.min.js similarity index 100% rename from ClipOne/html/js/jquery.nicescroll.min.js rename to html/js/jquery.nicescroll.min.js diff --git a/ClipOne/html/js/main.js b/html/js/main.js similarity index 100% rename from ClipOne/html/js/main.js rename to html/js/main.js diff --git a/ClipOne/model/ClipModel.cs b/model/ClipModel.cs similarity index 100% rename from ClipOne/model/ClipModel.cs rename to model/ClipModel.cs diff --git a/ClipOne/model/ClipType.cs b/model/ClipType.cs similarity index 100% rename from ClipOne/model/ClipType.cs rename to model/ClipType.cs diff --git a/ClipOne/model/Config.cs b/model/Config.cs similarity index 100% rename from ClipOne/model/Config.cs rename to model/Config.cs diff --git a/ClipOne/service/ClipService.cs b/service/ClipService.cs similarity index 95% rename from ClipOne/service/ClipService.cs rename to service/ClipService.cs index 17bbd48..5e139f9 100644 --- a/ClipOne/service/ClipService.cs +++ b/service/ClipService.cs @@ -81,7 +81,7 @@ public string SaveImage(BitmapSource bs) /// public void SetValueToClipboard(ClipModel result) { - + if (result.Type == WECHAT_TYPE) { MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(result.ClipValue)); @@ -476,14 +476,35 @@ public void HandleQQ(ClipModel clip) string plainText = Clipboard.GetText(); clip.PlainText = plainText; byte[] b = stream.ToArray(); - string xmlStr = System.Text.Encoding.UTF8.GetString(b); + string xmlStr = Encoding.UTF8.GetString(b); xmlStr = xmlStr.Substring(0, xmlStr.IndexOf("") + "".Length); + XmlDocument document = new XmlDocument(); document.LoadXml(xmlStr); XmlNodeList nodeList = document.SelectNodes("QQRichEditFormat/EditElement[@type='1']|QQRichEditFormat/EditElement[@type='2']|QQRichEditFormat/EditElement[@type='5']"); + + //如果只有一个图片且没有文字,则按图片处理 + if (GetOccurTimes(xmlStr, "filepath") == 1 && xmlStr.IndexOf("> 4) & 15); + buffer[num4++] = (byte)IntToHex(num6 & 15); + } + } + return buffer; + } + + public static bool IsUrlSafeChar(char ch) + { + if ((((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z'))) || ((ch >= '0') && (ch <= '9'))) + { + return true; + } + switch (ch) + { + case '(': + case ')': + case '*': + case '-': + case '.': + case '_': + case '!': + return true; + } + return false; + } + public static char IntToHex(int n) + { + if (n <= 9) + { + return (char)(n + 0x30); + } + return (char)((n - 10) + 0x61); + } + static public string UrlDecode(string value) + { + if (value == null) + { + return null; + } + Encoding encoding = Encoding.UTF8;//你的编码 也可能是GBK + int length = value.Length; + UrlDecoder decoder = new UrlDecoder(length, encoding); + for (int i = 0; i < length; i++) + { + char ch = value[i]; + if (ch == '+') + { + ch = ' '; + } + else if ((ch == '%') && (i < (length - 2))) + { + if ((value[i + 1] == 'u') && (i < (length - 5))) + { + int num3 = HexToInt(value[i + 2]); + int num4 = HexToInt(value[i + 3]); + int num5 = HexToInt(value[i + 4]); + int num6 = HexToInt(value[i + 5]); + if (((num3 < 0) || (num4 < 0)) || ((num5 < 0) || (num6 < 0))) + { + goto Label_010B; + } + ch = (char)((((num3 << 12) | (num4 << 8)) | (num5 << 4)) | num6); + i += 5; + decoder.AddChar(ch); + continue; + } + int num7 = HexToInt(value[i + 1]); + int num8 = HexToInt(value[i + 2]); + if ((num7 >= 0) && (num8 >= 0)) + { + byte b = (byte)((num7 << 4) | num8); + i += 2; + decoder.AddByte(b); + continue; + } + } + Label_010B: + if ((ch & 0xff80) == 0) + { + decoder.AddByte((byte)ch); + } + else + { + decoder.AddChar(ch); + } + } + return decoder.GetString(); + } + + public static int HexToInt(char h) + { + if ((h >= '0') && (h <= '9')) + { + return (h - '0'); + } + if ((h >= 'a') && (h <= 'f')) + { + return ((h - 'a') + 10); + } + if ((h >= 'A') && (h <= 'F')) + { + return ((h - 'A') + 10); + } + return -1; + } + /////////////////////////// + + public static string HtmlDecode(string value) + { + if (string.IsNullOrEmpty(value)) + { + return value; + } + + StringWriter output = new StringWriter(CultureInfo.InvariantCulture); + HtmlDecode(value, output); + return output.ToString(); + } + + public static void HtmlDecode(string value, TextWriter output) + { + if (value != null) + { + if (output == null) + { + throw new ArgumentNullException("output"); + } + if (value.IndexOf('&') < 0) + { + output.Write(value); + } + else + { + int length = value.Length; + for (int i = 0; i < length; i++) + { + char ch = value[i]; + if (ch == '&') + { + int num3 = value.IndexOfAny(_htmlEntityEndingChars, i + 1); + if ((num3 > 0) && (value[num3] == ';')) + { + string entity = value.Substring(i + 1, (num3 - i) - 1); + if ((entity.Length > 1) && (entity[0] == '#')) + { + ushort num4; + if ((entity[1] == 'x') || (entity[1] == 'X')) + { + ushort.TryParse(entity.Substring(2), NumberStyles.AllowHexSpecifier, (IFormatProvider)NumberFormatInfo.InvariantInfo, out num4); + } + else + { + ushort.TryParse(entity.Substring(1), NumberStyles.Integer, (IFormatProvider)NumberFormatInfo.InvariantInfo, out num4); + } + if (num4 != 0) + { + ch = (char)num4; + i = num3; + } + } + else + { + i = num3; + char ch2 = HtmlEntities.Lookup(entity); + if (ch2 != '\0') + { + ch = ch2; + } + else + { + output.Write('&'); + output.Write(entity); + output.Write(';'); + goto Label_0117; + } + } + } + } + output.Write(ch); + Label_0117:; + } + } + } + } + + + } + /// + /// class UrlDecoder + /// + class UrlDecoder + { + // Fields + private int _bufferSize; + private byte[] _byteBuffer; + private char[] _charBuffer; + private Encoding _encoding; + private int _numBytes; + private int _numChars; + + // Methods + internal UrlDecoder(int bufferSize, Encoding encoding) + { + this._bufferSize = bufferSize; + this._encoding = encoding; + this._charBuffer = new char[bufferSize]; + } + + internal void AddByte(byte b) + { + if (this._byteBuffer == null) + { + this._byteBuffer = new byte[this._bufferSize]; + } + this._byteBuffer[this._numBytes++] = b; + } + + internal void AddChar(char ch) + { + if (this._numBytes > 0) + { + this.FlushBytes(); + } + this._charBuffer[this._numChars++] = ch; + } + + private void FlushBytes() + { + if (this._numBytes > 0) + { + this._numChars += this._encoding.GetChars(this._byteBuffer, 0, this._numBytes, this._charBuffer, this._numChars); + this._numBytes = 0; + } + } + + internal string GetString() + { + if (this._numBytes > 0) + { + this.FlushBytes(); + } + if (this._numChars > 0) + { + return new string(this._charBuffer, 0, this._numChars); + } + return string.Empty; + } + } + /// + /// class HtmlEntities + /// + static class HtmlEntities + { + // Fields + private static string[] _entitiesList = new string[] { + "\"-quot", "&-amp", "'-apos", "<-lt", ">-gt", "\x00a0-nbsp", "\x00a1-iexcl", "\x00a2-cent", "\x00a3-pound", "\x00a4-curren", "\x00a5-yen", "\x00a6-brvbar", "\x00a7-sect", "\x00a8-uml", "\x00a9-copy", "\x00aa-ordf", + "\x00ab-laquo", "\x00ac-not", "\x00ad-shy", "\x00ae-reg", "\x00af-macr", "\x00b0-deg", "\x00b1-plusmn", "\x00b2-sup2", "\x00b3-sup3", "\x00b4-acute", "\x00b5-micro", "\x00b6-para", "\x00b7-middot", "\x00b8-cedil", "\x00b9-sup1", "\x00ba-ordm", + "\x00bb-raquo", "\x00bc-frac14", "\x00bd-frac12", "\x00be-frac34", "\x00bf-iquest", "\x00c0-Agrave", "\x00c1-Aacute", "\x00c2-Acirc", "\x00c3-Atilde", "\x00c4-Auml", "\x00c5-Aring", "\x00c6-AElig", "\x00c7-Ccedil", "\x00c8-Egrave", "\x00c9-Eacute", "\x00ca-Ecirc", + "\x00cb-Euml", "\x00cc-Igrave", "\x00cd-Iacute", "\x00ce-Icirc", "\x00cf-Iuml", "\x00d0-ETH", "\x00d1-Ntilde", "\x00d2-Ograve", "\x00d3-Oacute", "\x00d4-Ocirc", "\x00d5-Otilde", "\x00d6-Ouml", "\x00d7-times", "\x00d8-Oslash", "\x00d9-Ugrave", "\x00da-Uacute", + "\x00db-Ucirc", "\x00dc-Uuml", "\x00dd-Yacute", "\x00de-THORN", "\x00df-szlig", "\x00e0-agrave", "\x00e1-aacute", "\x00e2-acirc", "\x00e3-atilde", "\x00e4-auml", "\x00e5-aring", "\x00e6-aelig", "\x00e7-ccedil", "\x00e8-egrave", "\x00e9-eacute", "\x00ea-ecirc", + "\x00eb-euml", "\x00ec-igrave", "\x00ed-iacute", "\x00ee-icirc", "\x00ef-iuml", "\x00f0-eth", "\x00f1-ntilde", "\x00f2-ograve", "\x00f3-oacute", "\x00f4-ocirc", "\x00f5-otilde", "\x00f6-ouml", "\x00f7-divide", "\x00f8-oslash", "\x00f9-ugrave", "\x00fa-uacute", + "\x00fb-ucirc", "\x00fc-uuml", "\x00fd-yacute", "\x00fe-thorn", "\x00ff-yuml", "Œ-OElig", "œ-oelig", "Š-Scaron", "š-scaron", "Ÿ-Yuml", "ƒ-fnof", "ˆ-circ", "˜-tilde", "Α-Alpha", "Β-Beta", "Γ-Gamma", + "Δ-Delta", "Ε-Epsilon", "Ζ-Zeta", "Η-Eta", "Θ-Theta", "Ι-Iota", "Κ-Kappa", "Λ-Lambda", "Μ-Mu", "Ν-Nu", "Ξ-Xi", "Ο-Omicron", "Π-Pi", "Ρ-Rho", "Σ-Sigma", "Τ-Tau", + "Υ-Upsilon", "Φ-Phi", "Χ-Chi", "Ψ-Psi", "Ω-Omega", "α-alpha", "β-beta", "γ-gamma", "δ-delta", "ε-epsilon", "ζ-zeta", "η-eta", "θ-theta", "ι-iota", "κ-kappa", "λ-lambda", + "μ-mu", "ν-nu", "ξ-xi", "ο-omicron", "π-pi", "ρ-rho", "ς-sigmaf", "σ-sigma", "τ-tau", "υ-upsilon", "φ-phi", "χ-chi", "ψ-psi", "ω-omega", "ϑ-thetasym", "ϒ-upsih", + "ϖ-piv", " -ensp", " -emsp", " -thinsp", "‌-zwnj", "‍-zwj", "‎-lrm", "‏-rlm", "–-ndash", "—-mdash", "‘-lsquo", "’-rsquo", "‚-sbquo", "“-ldquo", "”-rdquo", "„-bdquo", + "†-dagger", "‡-Dagger", "•-bull", "…-hellip", "‰-permil", "′-prime", "″-Prime", "‹-lsaquo", "›-rsaquo", "‾-oline", "⁄-frasl", "€-euro", "ℑ-image", "℘-weierp", "ℜ-real", "™-trade", + "ℵ-alefsym", "←-larr", "↑-uarr", "→-rarr", "↓-darr", "↔-harr", "↵-crarr", "⇐-lArr", "⇑-uArr", "⇒-rArr", "⇓-dArr", "⇔-hArr", "∀-forall", "∂-part", "∃-exist", "∅-empty", + "∇-nabla", "∈-isin", "∉-notin", "∋-ni", "∏-prod", "∑-sum", "−-minus", "∗-lowast", "√-radic", "∝-prop", "∞-infin", "∠-ang", "∧-and", "∨-or", "∩-cap", "∪-cup", + "∫-int", "∴-there4", "∼-sim", "≅-cong", "≈-asymp", "≠-ne", "≡-equiv", "≤-le", "≥-ge", "⊂-sub", "⊃-sup", "⊄-nsub", "⊆-sube", "⊇-supe", "⊕-oplus", "⊗-otimes", + "⊥-perp", "⋅-sdot", "⌈-lceil", "⌉-rceil", "⌊-lfloor", "⌋-rfloor", "〈-lang", "〉-rang", "◊-loz", "♠-spades", "♣-clubs", "♥-hearts", "♦-diams" + }; + private static Dictionary _lookupTable = GenerateLookupTable(); + + // Methods + private static Dictionary GenerateLookupTable() + { + Dictionary dictionary = new Dictionary(StringComparer.Ordinal); + foreach (string str in _entitiesList) + { + dictionary.Add(str.Substring(2), str[0]); + } + return dictionary; + } + + public static char Lookup(string entity) + { + char ch; + _lookupTable.TryGetValue(entity, out ch); + return ch; + } + } +} diff --git a/ClipOne/util/KeyboardKit.cs b/util/KeyboardKit.cs similarity index 100% rename from ClipOne/util/KeyboardKit.cs rename to util/KeyboardKit.cs diff --git a/ClipOne/util/WinAPIHelper.cs b/util/WinAPIHelper.cs similarity index 100% rename from ClipOne/util/WinAPIHelper.cs rename to util/WinAPIHelper.cs diff --git a/ClipOne/view/MainWindow.xaml b/view/MainWindow.xaml similarity index 100% rename from ClipOne/view/MainWindow.xaml rename to view/MainWindow.xaml diff --git a/ClipOne/view/MainWindow.xaml.cs b/view/MainWindow.xaml.cs similarity index 99% rename from ClipOne/view/MainWindow.xaml.cs rename to view/MainWindow.xaml.cs index 389bd63..a685fbc 100644 --- a/ClipOne/view/MainWindow.xaml.cs +++ b/view/MainWindow.xaml.cs @@ -7,12 +7,11 @@ using Newtonsoft.Json; using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading; -using System.Web; + using System.Windows; using System.Windows.Controls; using System.Windows.Input; diff --git a/ClipOne/view/SetHotKeyForm.xaml b/view/SetHotKeyForm.xaml similarity index 100% rename from ClipOne/view/SetHotKeyForm.xaml rename to view/SetHotKeyForm.xaml diff --git a/ClipOne/view/SetHotKeyForm.xaml.cs b/view/SetHotKeyForm.xaml.cs similarity index 100% rename from ClipOne/view/SetHotKeyForm.xaml.cs rename to view/SetHotKeyForm.xaml.cs diff --git "a/ClipOne/\345\215\270\350\275\275\345\211\215\346\270\205\347\220\206\346\263\250\345\206\214\350\241\250.bat" "b/\345\215\270\350\275\275\345\211\215\346\270\205\347\220\206\346\263\250\345\206\214\350\241\250.bat" similarity index 100% rename from "ClipOne/\345\215\270\350\275\275\345\211\215\346\270\205\347\220\206\346\263\250\345\206\214\350\241\250.bat" rename to "\345\215\270\350\275\275\345\211\215\346\270\205\347\220\206\346\263\250\345\206\214\350\241\250.bat"