mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 09:17:36 +13:00
Added check contains image parameter
This commit is contained in:
parent
612ccc8ecc
commit
9aa35dbc6b
1 changed files with 23 additions and 20 deletions
|
@ -196,24 +196,6 @@ public static bool CopyFile(string[] paths)
|
|||
return false;
|
||||
}
|
||||
|
||||
public static bool CopyTextFromFile(string path)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(path) && File.Exists(path))
|
||||
{
|
||||
try
|
||||
{
|
||||
string text = File.ReadAllText(path, Encoding.UTF8);
|
||||
return CopyText(text);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e, "Clipboard copy text from file failed.");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool CopyImageFromFile(string path)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(path) && File.Exists(path))
|
||||
|
@ -234,15 +216,36 @@ public static bool CopyImageFromFile(string path)
|
|||
return false;
|
||||
}
|
||||
|
||||
public static Image GetImage()
|
||||
public static bool CopyTextFromFile(string path)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(path) && File.Exists(path))
|
||||
{
|
||||
try
|
||||
{
|
||||
string text = File.ReadAllText(path, Encoding.UTF8);
|
||||
return CopyText(text);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e, "Clipboard copy text from file failed.");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Image GetImage(bool checkContainsImage = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (ClipboardLock)
|
||||
{
|
||||
if (!checkContainsImage || Clipboard.ContainsImage())
|
||||
{
|
||||
return Clipboard.GetImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e, "Clipboard get image failed.");
|
||||
|
|
Loading…
Reference in a new issue