【发布时间】:2021-01-26 04:48:33
【问题描述】:
如果我在终端中运行它,我刚刚制作了一个 c# 应用程序来组织我的桌面
/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono Program.exe
我的程序正常运行,所以我想用 Mac automator 自动启动。 bash 命令亮起绿灯,但是当我打开应用程序时,它会打开然后立即停止。我做错了什么还是有不同的方式在启动时运行我的脚本。 这是我的 c# 代码的主要部分,如果有帮助,我可以将其全部粘贴在这里。
static void Main(string[] args)
{
FileSystemWatcher fileSystemWatcher = new FileSystemWatcher();
fileSystemWatcher.Path = "/Users/user/Desktop/SortTheseFiles";
fileSystemWatcher.Created += FileChanged;
fileSystemWatcher.Changed += FileChanged;
fileSystemWatcher.Renamed += FileChanged;
fileSystemWatcher.EnableRaisingEvents = true;
FileSystemWatcher fileSystemWatcherDownloads = new FileSystemWatcher();
fileSystemWatcherDownloads.Path = "/Users/user/Downloads";
fileSystemWatcherDownloads.Created += DownloadsChanged;
fileSystemWatcherDownloads.Changed += DownloadsChanged;
fileSystemWatcherDownloads.Renamed += DownloadsChanged;
fileSystemWatcherDownloads.Deleted += DownloadsChanged;
fileSystemWatcherDownloads.EnableRaisingEvents = true;
Console.ReadKey();
}
【问题讨论】:
标签: c# bash macos automation