Exemple #1
0
        public string ProcessNameFromId(int processId)
        {
            Exception innerException = null;
            Process   process        = null;

            try
            {
                process = _processAbstraction.GetProcessById(processId);
            }
#pragma warning disable CA1031
            catch (Exception e)
#pragma warning restore CA1031
            {
                innerException = e;
            }

            if (string.IsNullOrEmpty(process?.ProcessName))
            {
                throw new ParameterException(
                          string.Format(CultureInfo.CurrentCulture, DisplayStrings.ErrorNoMatchingProcessIdFormat, processId),
                          innerException);
            }

            return(process.ProcessName);
        }
Exemple #2
0
        public string ProcessNameFromId(int processId)
        {
            Exception innerException = null;
            Process   process        = null;

            try
            {
                process = _processAbstraction.GetProcessById(processId);
            }
#pragma warning disable CA1031
            catch (Exception e)
#pragma warning restore CA1031
            {
                innerException = e;
            }

            if (string.IsNullOrEmpty(process?.ProcessName))
            {
                throw new ParameterException("Unable to find process with id " + processId, innerException);
            }

            return(process.ProcessName);
        }