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
{"lastUpload":"2021-03-13T22:05:37.704Z","extensionVersion":"v3.4.3"} |
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
''' | |
SMWinservice | |
by Davide Mastromatteo | |
from https://medium.com/the-python-corner/how-to-create-a-windows-service-in-python-88ca534ce76b | |
Base class to create winservice in Python | |
----------------------------------------- | |
Instructions: |
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
public void ListDirectory(string remoteDirectory, string host, string username, string password) | |
{ | |
try | |
{ | |
using (var sftpClient = new SftpClient(host, username, password)) | |
{ | |
sftpClient.Connect(); | |
var files = sftpClient.ListDirectory(remoteDirectory); |
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
public void Upload(string fileToUpload, string host, string username, string password) | |
{ | |
try | |
{ | |
using (var sftpClient = new SftpClient(host, username, password)) | |
using (var fs = new FileStream(fileToUpload, FileMode.Open)) | |
{ | |
sftpClient.Connect(); | |
sftpClient.UploadFile( |
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
public void Download(string fileToDownload, string host, string username, string password) | |
{ | |
try | |
{ | |
using (var sftpClient = new SftpClient(host, username, password)) | |
using (var fs = new FileStream(Path.GetFileName(fileToDownload), FileMode.OpenOrCreate)) | |
{ | |
sftpClient.Connect(); | |
sftpClient.DownloadFile( |
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
public void Delete(string fileToDelete, string host, string username, string password) | |
{ | |
try | |
{ | |
using (var sftpClient = new SftpClient(host, username, password)) | |
{ | |
sftpClient.Connect(); | |
sftpClient.DeleteFile(fileToDelete); |
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
#Persistent | |
Toggle := false ; Initialize the toggle state to "off" | |
Return | |
^!t:: ; Hotkey: Ctrl + Alt + T | |
Toggle := !Toggle ; Toggle the state (on/off) | |
If (Toggle) | |
{ | |
SetTimer, LoopWindows, 6000 ; Start the timer | |
} |