private static void Main(string[] args)
{
try
{
SetupForLogging();
Stopwatch.Start();
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
Log("Info", "Task Started");
if(args.Length < 2)
{
Log("Error", "Invalid arguments passed in.");
return;
}
var paramters = new Dictionary<string, string>();
for(int i = 0; i < args.Count(); i++)
{
string[] singleParameters = args[i].Split(':');
paramters.Add(singleParameters[0],
singleParameters.Skip(1).Aggregate((a, b) => String.Format("{0}:{1}", a, b)));
}
Log("Info", string.Format("Start execution of {0}", paramters["Workflow"]));
try
{
PostDataToWebserverAsRemoteAgent(paramters["Workflow"], paramters["TaskName"], Guid.NewGuid());
}
catch
{
CreateDebugState("Warewolf Server Unavailable", paramters["Workflow"], paramters["TaskName"]);
throw;
}
}
catch(Exception e)
{
Log("Error", string.Format("Error from execution: {0}{1}", e.Message, e.StackTrace));
Environment.Exit(1);
}
}