@@ -10,9 +10,9 @@ internal class PortDetail
1010 public int Port { get ; set ; }
1111 public int ProcessID { get ; set ; }
1212 public string ProcessName { get ; set ; }
13-
1413 public Process Process { get ; set ; }
1514 public string Path { get ; set ; }
15+
1616 public override string ToString ( )
1717 {
1818 return $@ " Process Name: { ProcessName } , Process ID: { ProcessID } , Port: { Port } , Path : { Path } ";
@@ -80,12 +80,12 @@ public static Tuple<bool, PortDetail> GetPortDetails(int port, PluginInitContext
8080
8181 PortDetail . Port = port ;
8282 PortDetail . ProcessID = int . Parse ( stringTokens [ 4 ] . Trim ( ) ) ;
83- Tuple < string , string > processNameAndPath ;
83+ ( string Name , string Path ) processNameAndPath ;
8484 try
8585 {
8686 processNameAndPath = GetProcessNameAndCommandLineArgs ( PortDetail . ProcessID , context ) ;
87- PortDetail . ProcessName = processNameAndPath . Item1 ;
88- PortDetail . Path = processNameAndPath . Item2 ;
87+ PortDetail . ProcessName = processNameAndPath . Name ;
88+ PortDetail . Path = processNameAndPath . Path ;
8989 PortDetail . Process = Process . GetProcessById ( PortDetail . ProcessID ) ;
9090 result = Tuple . Create ( true , PortDetail ) ;
9191 }
@@ -106,9 +106,10 @@ public static Tuple<bool, PortDetail> GetPortDetails(int port, PluginInitContext
106106 /// <param name="processID"></param>
107107 /// <param name="context"></param>
108108 /// <returns></returns>
109- private static Tuple < string , string > GetProcessNameAndCommandLineArgs ( int processID , PluginInitContext context )
109+ private static ( string Name , string Path ) GetProcessNameAndCommandLineArgs ( int processID , PluginInitContext context )
110110 {
111- Tuple < string , string > result = Tuple . Create ( string . Empty , string . Empty ) ;
111+ var name = string . Empty ;
112+ var path = string . Empty ;
112113 string query = string . Format ( "Select Name,ExecutablePath from Win32_Process WHERE ProcessId='{0}'" , processID ) ;
113114 try
114115 {
@@ -119,8 +120,8 @@ private static Tuple<string, string> GetProcessNameAndCommandLineArgs(int proces
119120 // interested in first result.
120121 foreach ( var item in results . Cast < ManagementObject > ( ) )
121122 {
122- result = Tuple . Create ( Convert . ToString ( item [ "Name" ] ) ,
123- Convert . ToString ( item [ "ExecutablePath" ] ) ) ;
123+ name = Convert . ToString ( item [ "Name" ] ) ;
124+ path = Convert . ToString ( item [ "ExecutablePath" ] ) ;
124125 break ;
125126 }
126127 }
@@ -129,7 +130,7 @@ private static Tuple<string, string> GetProcessNameAndCommandLineArgs(int proces
129130 context . API . LogException ( ClassName , "Failed to get process name and path" , e ) ;
130131 }
131132
132- return result ;
133+ return ( name , path ) ;
133134 }
134135
135136 /// <summary>
0 commit comments