mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-18 09:35:48 +00:00
Removal of ToArray()
This commit is contained in:
parent
9eb22da9e7
commit
9f5cf132f0
41 changed files with 184 additions and 189 deletions
|
|
@ -277,7 +277,7 @@ namespace ServerManagerTool.Updater
|
|||
var processes = ProcessUtils.GetProcesses(process.ProcessName, executablePath);
|
||||
|
||||
// check if there is more than one instance of the application running
|
||||
if (processes.Length != 1)
|
||||
if (processes.Count() != 1)
|
||||
throw new Exception("The application to be updated has more than one instance running.");
|
||||
|
||||
// get the command line of the process
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
|
@ -83,7 +84,7 @@ namespace ServerManagerTool.Updater
|
|||
return Process.GetProcessById(processId);
|
||||
}
|
||||
|
||||
public static Process[] GetProcesses(string processName, string executablePath)
|
||||
public static IEnumerable<Process> GetProcesses(string processName, string executablePath)
|
||||
{
|
||||
var runningProcesses = Process.GetProcessesByName(processName).ToList();
|
||||
|
||||
|
|
@ -95,7 +96,7 @@ namespace ServerManagerTool.Updater
|
|||
runningProcesses.RemoveAt(i);
|
||||
}
|
||||
|
||||
return runningProcesses.ToArray();
|
||||
return runningProcesses;
|
||||
}
|
||||
|
||||
public static bool IsAlreadyRunning()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue