namespace FromShellExecute
{
class Program
{
static void Main(string[] args)
{
var asm = Assembly.GetEntryAssembly();
if (asm != null)
{
Console.WriteLine("GetEntryAssembly=" + asm.Location);
Console.WriteLine();
}
asm = Assembly.GetExecutingAssembly();
if (asm != null)
{
Console.WriteLine("GetExecutingAssembly=" + asm.Location);
Console.WriteLine();
}
asm = Assembly.GetCallingAssembly();
if (asm != null)
{
Console.WriteLine("GetCallingAssembly=" + asm.Location);
Console.WriteLine();
}
asm = Assembly.GetAssembly(typeof(FromShellExecute.Program));
if (asm != null)
{
Console.WriteLine("GetAssembly(this)=" + asm.Location);
Console.WriteLine();
}
Console.WriteLine("Application.ExecutablePath=" + Application.ExecutablePath);
Console.WriteLine();
Console.WriteLine("AppDomain.CurrentDomain.BaseDirectory=" + AppDomain.CurrentDomain.BaseDirectory);
Console.WriteLine();
Console.WriteLine("%1=" + args[0]);
Console.WriteLine();
Console.ReadKey();
}
}
}
bmFtZXNwYWNlIEZyb21TaGVsbEV4ZWN1dGUKewogICAgY2xhc3MgUHJvZ3JhbQogICAgewogICAgICAgIHN0YXRpYyB2b2lkIE1haW4oc3RyaW5nW10gYXJncykKICAgICAgICB7CiAgICAgICAgICAgIHZhciBhc20gPSBBc3NlbWJseS5HZXRFbnRyeUFzc2VtYmx5KCk7CiAgICAgICAgICAgIGlmIChhc20gIT0gbnVsbCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkdldEVudHJ5QXNzZW1ibHk9IiArIGFzbS5Mb2NhdGlvbik7CiAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBhc20gPSBBc3NlbWJseS5HZXRFeGVjdXRpbmdBc3NlbWJseSgpOwogICAgICAgICAgICBpZiAoYXNtICE9IG51bGwpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJHZXRFeGVjdXRpbmdBc3NlbWJseT0iICsgYXNtLkxvY2F0aW9uKTsKICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGFzbSA9IEFzc2VtYmx5LkdldENhbGxpbmdBc3NlbWJseSgpOwogICAgICAgICAgICBpZiAoYXNtICE9IG51bGwpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJHZXRDYWxsaW5nQXNzZW1ibHk9IiArIGFzbS5Mb2NhdGlvbik7CiAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBhc20gPSBBc3NlbWJseS5HZXRBc3NlbWJseSh0eXBlb2YoRnJvbVNoZWxsRXhlY3V0ZS5Qcm9ncmFtKSk7CiAgICAgICAgICAgIGlmIChhc20gIT0gbnVsbCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkdldEFzc2VtYmx5KHRoaXMpPSIgKyBhc20uTG9jYXRpb24pOwogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkFwcGxpY2F0aW9uLkV4ZWN1dGFibGVQYXRoPSIgKyBBcHBsaWNhdGlvbi5FeGVjdXRhYmxlUGF0aCk7CiAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCk7CiAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJBcHBEb21haW4uQ3VycmVudERvbWFpbi5CYXNlRGlyZWN0b3J5PSIgKyBBcHBEb21haW4uQ3VycmVudERvbWFpbi5CYXNlRGlyZWN0b3J5KTsKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoKTsKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIiUxPSIgKyBhcmdzWzBdKTsKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoKTsKICAgICAgICAgICAgQ29uc29sZS5SZWFkS2V5KCk7CgogICAgICAgIH0KICAgIH0KfQ==