-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
99 additions
and
96 deletions.
There are no files selected for viewing
36 changes: 18 additions & 18 deletions
36
...vscode-plugin/src/util/clipboard/linux.sh → ...scode-plugin/resources/clipboard/linux.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
#!/bin/sh | ||
# require xclip(see http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script/677212#677212) | ||
command -v xclip >/dev/null 2>&1 || { echo >&1 "no xclip"; exit 1; } | ||
|
||
# write image in clipboard to file (see http://unix.stackexchange.com/questions/145131/copy-image-from-clipboard-to-file) | ||
filePath=`xclip -selection clipboard -o 2>/dev/null | grep ^file:// | cut -c8-` | ||
if [ ! -n "$filePath" ] ;then | ||
if | ||
xclip -selection clipboard -target image/png -o >/dev/null 2>&1 | ||
then | ||
xclip -selection clipboard -target image/png -o >$1 2>/dev/null | ||
echo $1 | ||
else | ||
echo "no image" | ||
fi | ||
else | ||
echo $filePath | ||
fi | ||
#!/bin/sh | ||
# require xclip(see http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script/677212#677212) | ||
command -v xclip >/dev/null 2>&1 || { echo >&1 "no xclip"; exit 1; } | ||
|
||
# write image in clipboard to file (see http://unix.stackexchange.com/questions/145131/copy-image-from-clipboard-to-file) | ||
filePath=`xclip -selection clipboard -o 2>/dev/null | grep ^file:// | cut -c8-` | ||
if [ ! -n "$filePath" ] ;then | ||
if | ||
xclip -selection clipboard -target image/png -o >/dev/null 2>&1 | ||
then | ||
xclip -selection clipboard -target image/png -o >$1 2>/dev/null | ||
echo $1 | ||
else | ||
echo "no image" | ||
fi | ||
else | ||
echo $filePath | ||
fi |
File renamed without changes.
52 changes: 26 additions & 26 deletions
52
...ode-plugin/src/util/clipboard/windows.ps1 → ...de-plugin/resources/clipboard/windows.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
|
||
param($imagePath) | ||
|
||
# Adapted from https://github.com/octan3/img-clipboard-dump/blob/master/dump-clipboard-png.ps1 | ||
|
||
Add-Type -Assembly PresentationCore | ||
$img = [Windows.Clipboard]::GetImage() | ||
|
||
if ($img -eq $null) { | ||
"no image" | ||
Exit 1 | ||
} | ||
|
||
if (-not $imagePath) { | ||
"no image" | ||
Exit 1 | ||
} | ||
|
||
$fcb = new-object Windows.Media.Imaging.FormatConvertedBitmap($img, [Windows.Media.PixelFormats]::Rgb24, $null, 0) | ||
$stream = [IO.File]::Open($imagePath, "OpenOrCreate") | ||
$encoder = New-Object Windows.Media.Imaging.PngBitmapEncoder | ||
$encoder.Frames.Add([Windows.Media.Imaging.BitmapFrame]::Create($fcb)) | out-null | ||
$encoder.Save($stream) | out-null | ||
$stream.Dispose() | out-null | ||
|
||
$imagePath | ||
|
||
param($imagePath) | ||
|
||
# Adapted from https://github.com/octan3/img-clipboard-dump/blob/master/dump-clipboard-png.ps1 | ||
|
||
Add-Type -Assembly PresentationCore | ||
$img = [Windows.Clipboard]::GetImage() | ||
|
||
if ($img -eq $null) { | ||
"no image" | ||
Exit 1 | ||
} | ||
|
||
if (-not $imagePath) { | ||
"no image" | ||
Exit 1 | ||
} | ||
|
||
$fcb = new-object Windows.Media.Imaging.FormatConvertedBitmap($img, [Windows.Media.PixelFormats]::Rgb24, $null, 0) | ||
$stream = [IO.File]::Open($imagePath, "OpenOrCreate") | ||
$encoder = New-Object Windows.Media.Imaging.PngBitmapEncoder | ||
$encoder.Frames.Add([Windows.Media.Imaging.BitmapFrame]::Create($fcb)) | out-null | ||
$encoder.Save($stream) | out-null | ||
$stream.Dispose() | out-null | ||
|
||
$imagePath |
92 changes: 46 additions & 46 deletions
92
...e-plugin/src/util/clipboard/windows10.ps1 → ...-plugin/resources/clipboard/windows10.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
# Adapted from https://github.com/octan3/img-clipboard-dump/blob/master/dump-clipboard-png.ps1 | ||
param($imagePath) | ||
|
||
# https://github.com/PowerShell/PowerShell/issues/7233 | ||
# fix the output encoding bug | ||
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding | ||
|
||
Add-Type -Assembly PresentationCore | ||
function main { | ||
$img = [Windows.Clipboard]::GetImage() | ||
|
||
if ($img -eq $null) { | ||
"no image" | ||
Exit 1 | ||
} | ||
|
||
if (-not $imagePath) { | ||
"no image" | ||
Exit 1 | ||
} | ||
|
||
$fcb = new-object Windows.Media.Imaging.FormatConvertedBitmap($img, [Windows.Media.PixelFormats]::Rgb24, $null, 0) | ||
$stream = [IO.File]::Open($imagePath, "OpenOrCreate") | ||
$encoder = New-Object Windows.Media.Imaging.PngBitmapEncoder | ||
$encoder.Frames.Add([Windows.Media.Imaging.BitmapFrame]::Create($fcb)) | out-null | ||
$encoder.Save($stream) | out-null | ||
$stream.Dispose() | out-null | ||
|
||
$imagePath | ||
# fix windows 10 native cmd crash bug when "picgo upload" | ||
# https://github.com/PicGo/PicGo-Core/issues/32 | ||
Exit 1 | ||
} | ||
|
||
try { | ||
# For WIN10 | ||
$file = Get-Clipboard -Format FileDropList | ||
if ($file -ne $null) { | ||
Convert-Path $file | ||
Exit 1 | ||
} | ||
} catch { | ||
# For WIN7 WIN8 WIN10 | ||
main | ||
} | ||
|
||
# Adapted from https://github.com/octan3/img-clipboard-dump/blob/master/dump-clipboard-png.ps1 | ||
param($imagePath) | ||
|
||
# https://github.com/PowerShell/PowerShell/issues/7233 | ||
# fix the output encoding bug | ||
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding | ||
|
||
Add-Type -Assembly PresentationCore | ||
function main { | ||
$img = [Windows.Clipboard]::GetImage() | ||
|
||
if ($img -eq $null) { | ||
"no image" | ||
Exit 1 | ||
} | ||
|
||
if (-not $imagePath) { | ||
"no image" | ||
Exit 1 | ||
} | ||
|
||
$fcb = new-object Windows.Media.Imaging.FormatConvertedBitmap($img, [Windows.Media.PixelFormats]::Rgb24, $null, 0) | ||
$stream = [IO.File]::Open($imagePath, "OpenOrCreate") | ||
$encoder = New-Object Windows.Media.Imaging.PngBitmapEncoder | ||
$encoder.Frames.Add([Windows.Media.Imaging.BitmapFrame]::Create($fcb)) | out-null | ||
$encoder.Save($stream) | out-null | ||
$stream.Dispose() | out-null | ||
|
||
$imagePath | ||
# fix windows 10 native cmd crash bug when "picgo upload" | ||
# https://github.com/PicGo/PicGo-Core/issues/32 | ||
Exit 1 | ||
} | ||
|
||
try { | ||
# For WIN10 | ||
$file = Get-Clipboard -Format FileDropList | ||
if ($file -ne $null) { | ||
Convert-Path $file | ||
Exit 1 | ||
} | ||
} catch { | ||
# For WIN7 WIN8 WIN10 | ||
main | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import path from 'path' | ||
|
||
export const RootPath = path.resolve(__dirname, '..') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters