improve get calling command
This commit is contained in:
parent
25ac5378e1
commit
7b3b0f07e5
1 changed files with 17 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Org.BouncyCastle.Utilities;
|
||||||
|
|
||||||
namespace SecondBotEvents.Services
|
namespace SecondBotEvents.Services
|
||||||
{
|
{
|
||||||
|
|
@ -230,7 +231,22 @@ namespace SecondBotEvents.Services
|
||||||
|
|
||||||
protected static string GetCallingCommand()
|
protected static string GetCallingCommand()
|
||||||
{
|
{
|
||||||
return (new System.Diagnostics.StackTrace()).GetFrame(2).GetMethod().Name;
|
string commandName = "Unable to get";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int index = 2;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
commandName = (new System.Diagnostics.StackTrace()).GetFrame(index).GetMethod().Name;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
while (commandName.StartsWith("InvokeWith") == true);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
commandName = "errorFetchCommandName";
|
||||||
|
}
|
||||||
|
return commandName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue