using System; using System.IO; using System.Diagnostics; using System.Windows.Forms; using IWshRuntimeLibrary; namespace Custom_Installer.Controls { public partial class Finish : UserControl { public String SavePath { get; set; } public Finish() { InitializeComponent(); } private void Finish_Load(Object Sender, EventArgs Arguments) { Information.Text = String.Format("Thanks For Installing {0}! :D{1}Here Are A Phew Options For You.{1}1) Create An Item On Your Desktop That Opens Launcher.{1}2) Open The Game When Installer Closes.!", Properties.Settings.Default.Server_Name, Environment.NewLine); } private void Close_Click(Object Sender, EventArgs Arguments) { if (Shortcut.Checked) { CreateShortcut(); } if (StartGame.Checked) { StartLauncher(); } Program.Shutdown(); } private void CreateShortcut() { WshShell WSHShell = new WshShell(); IWshShortcut ShortcutCreator = (IWshShortcut)WSHShell.CreateShortcut(String.Format("{0}\\Desktop\\{1}.lnk", Environment.GetEnvironmentVariable("USERPROFILE"), Properties.Settings.Default.Server_Name)); ShortcutCreator.TargetPath = String.Format("{0}{1}", SavePath, Properties.Settings.Default.LauncherFile); ShortcutCreator.WorkingDirectory = SavePath; ShortcutCreator.Save(); } private void StartLauncher() { Process Launcher = new Process(); Launcher.StartInfo.FileName = String.Format("{0}{1}", SavePath, Properties.Settings.Default.LauncherFile); Launcher.StartInfo.WorkingDirectory = SavePath; Launcher.Start(); Program.Shutdown(); } private void Information_Click(object sender, EventArgs e) { } } }