Skip to content

Commit

Permalink
Fix the Clipboard read error, issue Wox-launcher#9
Browse files Browse the repository at this point in the history
  • Loading branch information
soxfmr committed Jul 1, 2018
1 parent c398af4 commit c59e40e
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 2,270 deletions.
33 changes: 21 additions & 12 deletions ClipboardMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,26 +117,35 @@ protected override void WndProc(ref Message m)

private void ClipChanged()
{
IDataObject iData = System.Windows.Forms.Clipboard.GetDataObject();

IDataObject iData = null;
ClipboardFormat? format = null;

foreach (var f in formats)
try
{
if (iData.GetDataPresent(f))
iData = System.Windows.Forms.Clipboard.GetDataObject();

foreach (var f in formats)
{
format = (ClipboardFormat)Enum.Parse(typeof(ClipboardFormat), f);
break;
if (iData.GetDataPresent(f))
{
format = (ClipboardFormat)Enum.Parse(typeof(ClipboardFormat), f);
break;
}
}
}

object data = iData.GetData(format.ToString());
object data = iData.GetData(format.ToString());

if (data == null || format == null)
return;
if (data == null || format == null)
return;

if (OnClipboardChange != null)
OnClipboardChange((ClipboardFormat)format, data);
if (OnClipboardChange != null)
OnClipboardChange((ClipboardFormat)format, data);
}
catch (ExternalException ex)
{
// The internal implements will raise the ExternalExcption
// when the clipboard is being used by the another process.
}
}


Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.1")]
[assembly: AssemblyFileVersion("1.1.0.1")]
9 changes: 6 additions & 3 deletions Wox.Plugin.Clipboard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsInput">
<Reference Include="WindowsInput, Version=1.0.4.0, Culture=neutral, PublicKeyToken=9b287f7dc5073cad, processorArchitecture=MSIL">
<HintPath>packages\InputSimulator.1.0.4.0\lib\net20\WindowsInput.dll</HintPath>
</Reference>
<Reference Include="Wox.Plugin">
<HintPath>..\Wox\Output\Debug\Wox.Plugin.dll</HintPath>
<Reference Include="Wox.Plugin, Version=1.2.0.486, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Wox.Plugin.1.2.0.486\lib\net35\Wox.Plugin.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand All @@ -62,6 +62,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
Expand Down
11 changes: 11 additions & 0 deletions obj/Debug/Wox.Plugin.Clipboard.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,14 @@ d:\Personal\Github\Wox.Plugin.ClipboardManager\bin\WindowsInput.xml
d:\Personal\Github\Wox.Plugin.ClipboardManager\bin\Wox.Plugin.pdb
d:\Personal\Github\Wox.Plugin.ClipboardManager\obj\Debug\Wox.Plugin.Clipboard.dll
d:\Personal\Github\Wox.Plugin.ClipboardManager\obj\Debug\Wox.Plugin.Clipboard.pdb
C:\Users\Yu\Cabinet\Sources\CS\Wox.Plugin.ClipboardManager\bin\Images\clipboard.png
C:\Users\Yu\Cabinet\Sources\CS\Wox.Plugin.ClipboardManager\bin\plugin.json
C:\Users\Yu\Cabinet\Sources\CS\Wox.Plugin.ClipboardManager\bin\Wox.Plugin.Clipboard.dll
C:\Users\Yu\Cabinet\Sources\CS\Wox.Plugin.ClipboardManager\bin\Wox.Plugin.Clipboard.pdb
C:\Users\Yu\Cabinet\Sources\CS\Wox.Plugin.ClipboardManager\bin\WindowsInput.dll
C:\Users\Yu\Cabinet\Sources\CS\Wox.Plugin.ClipboardManager\bin\Wox.Plugin.dll
C:\Users\Yu\Cabinet\Sources\CS\Wox.Plugin.ClipboardManager\bin\WindowsInput.xml
C:\Users\Yu\Cabinet\Sources\CS\Wox.Plugin.ClipboardManager\obj\Debug\Wox.Plugin.Clipboard.csproj.CoreCompileInputs.cache
C:\Users\Yu\Cabinet\Sources\CS\Wox.Plugin.ClipboardManager\obj\Debug\Wox.Plugin.Clipboard.csproj.CopyComplete
C:\Users\Yu\Cabinet\Sources\CS\Wox.Plugin.ClipboardManager\obj\Debug\Wox.Plugin.Clipboard.dll
C:\Users\Yu\Cabinet\Sources\CS\Wox.Plugin.ClipboardManager\obj\Debug\Wox.Plugin.Clipboard.pdb
2 changes: 1 addition & 1 deletion packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="InputSimulator" version="1.0.4.0" targetFramework="net35" />
<package id="WindowsInput" version="0.2.0.0" targetFramework="net35" />
<package id="Wox.Plugin" version="1.2.0.486" targetFramework="net35" />
</packages>
16 changes: 0 additions & 16 deletions packages/InputSimulator.1.0.4.0/InputSimulator.1.0.4.0.nuspec

This file was deleted.

Binary file not shown.
16 changes: 0 additions & 16 deletions packages/WindowsInput.0.2.0.0/WindowsInput.0.2.0.0.nuspec

This file was deleted.

Loading

0 comments on commit c59e40e

Please sign in to comment.