This file contains hidden or 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
private string GetServiceExecutablePath(string serviceName) | |
{ | |
using (RegistryKey key = Registry.LocalMachine.OpenSubKey($@"SYSTEM\CurrentControlSet\Services\{serviceName}")) | |
{ | |
if (key != null) | |
{ | |
var imagePath = key.GetValue("ImagePath") as string; | |
if (!string.IsNullOrEmpty(imagePath)) | |
{ | |
// Trim surrounding quotes if any |
This file contains hidden or 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
var semaphore = new SemaphoreSlim(50);//50 là max số task đồng thời | |
var downloadTasks = lstIds.Select(async id => | |
{ | |
await semaphore.WaitAsync(); | |
try | |
{ | |
//Xử lý logic ở đây | |
return individualMsg; | |
} | |
finally |