Advertisement
Guest User

Form1.cs

a guest
May 12th, 2014
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.96 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. using System.IO;
  4. using System.Reflection;
  5. using System.Windows.Forms;
  6.  
  7. namespace HL2_Cinematic_Mod_Launcher
  8. {
  9.  
  10.     public partial class Form1 : Form
  11.     {
  12.         private ToolStripMenuItem _fileToolStripMenuItem;
  13.  
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.  
  19.         public void Form1_Load(object sender, EventArgs e)
  20.         {
  21.         }
  22.  
  23.         string _gameDir = null;
  24.  
  25.         private void button1_Click(object sender, EventArgs e)
  26.         {
  27.             var myDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
  28.             if (myDir == null) return;
  29.  
  30.             if (string.IsNullOrEmpty(_gameDir))
  31.             {
  32.                 MessageBox.Show(@"Please select the Cinematic Mod installation directory first");
  33.                 return;
  34.             }
  35.  
  36.             var gameExe = Path.Combine(_gameDir, "Configurator.EXE");
  37.             var proc1 = new Process
  38.             {
  39.                 StartInfo = { FileName = gameExe, WorkingDirectory = _gameDir },
  40.                 SynchronizingObject = this,
  41.                 EnableRaisingEvents = true
  42.             };
  43.             proc1.Start();
  44.         }
  45.  
  46.         private void button2_Click(object sender, EventArgs e)
  47.         {
  48.             var myDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
  49.             if (myDir == null) return;
  50.  
  51.             if (string.IsNullOrEmpty(_gameDir))
  52.             {
  53.                 MessageBox.Show(@"Please select the Cinematic Mod installation directory first");
  54.                 return;
  55.             }
  56.  
  57.             var gameExe = Path.Combine(_gameDir, "Launcher_EP0.exe");
  58.             var proc2 = new Process
  59.             {
  60.                 StartInfo = { FileName = gameExe, WorkingDirectory = _gameDir },
  61.                 SynchronizingObject = this,
  62.                 EnableRaisingEvents = true
  63.             };
  64.             proc2.Start();
  65.  
  66.         }
  67.  
  68.         private void button3_Click(object sender, EventArgs e)
  69.         {
  70.             var myDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
  71.             if (myDir == null) return;
  72.  
  73.             if (string.IsNullOrEmpty(_gameDir))
  74.             {
  75.                 MessageBox.Show(@"Please select the Cinematic Mod installation directory first");
  76.                 return;
  77.             }
  78.  
  79.             var gameExe = Path.Combine(_gameDir, "launcher_EP1.exe");
  80.             var proc3 = new Process
  81.  
  82.             {
  83.                 StartInfo = { FileName = gameExe, WorkingDirectory = _gameDir },
  84.                 SynchronizingObject = this,
  85.                 EnableRaisingEvents = true
  86.             };
  87.             proc3.Start();
  88.         }
  89.  
  90.         private void button4_Click(object sender, EventArgs e)
  91.         {
  92.             var myDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
  93.             if (myDir == null) return;
  94.  
  95.             if (string.IsNullOrEmpty(_gameDir))
  96.             {
  97.                 MessageBox.Show(@"Please select the Cinematic Mod installation directory first");
  98.                 return;
  99.             }
  100.  
  101.             var gameExe = Path.Combine(_gameDir, "Launcher_EP2.exe");
  102.             var proc4 = new Process
  103.  
  104.             {
  105.                 StartInfo = { FileName = gameExe, WorkingDirectory = _gameDir },
  106.                 SynchronizingObject = this,
  107.                 EnableRaisingEvents = true
  108.             };
  109.             proc4.Start();
  110.  
  111.         }
  112.  
  113.         private void button5_Click(object sender, EventArgs e)
  114.         {
  115.  
  116.             var fbd = new FolderBrowserDialog
  117.             {
  118.                 Description = @"Please select the Cinematic Mod installation directory."
  119.             };
  120.  
  121.             if (fbd.ShowDialog() != DialogResult.OK) return;
  122.            
  123.             {
  124.                 _gameDir = fbd.SelectedPath;
  125.             }
  126.         }
  127.  
  128.         private void exitToolStripMenuItem_Click(object sender, EventArgs e)
  129.         {
  130.             Close();
  131.         }
  132.     }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement