Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.67 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10.  
  11. namespace sPCK_GUI
  12. {
  13.     public partial class mainForm : Form
  14.     {
  15.         public mainForm()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.  
  21.  
  22.         private void mainForm_Load(object sender, EventArgs e)
  23.         {
  24.  
  25.             if (Properties.Settings.Default.pckPath == null)
  26.             {
  27.                 MessageBox.Show("warning! no path for .pck files found!");
  28.             }
  29.  
  30.             else
  31.  
  32.             textBox2.Text = Properties.Settings.Default.pckPath;
  33.             // find the .pck files
  34.  
  35.             string folder = @"" + Properties.Settings.Default.pckPath;
  36.             string[] pckFiles = Directory.GetFiles(folder, "*.pck");
  37.             listBox1.Items.AddRange(pckFiles);
  38.  
  39.             // find the .list folders
  40.             string path = @"" + Properties.Settings.Default.pckPath;
  41.             string[] dirs = Directory.GetDirectories(path);
  42.             foreach (string dir in dirs)
  43.                 listBox2.Items.Add(dir);
  44.  
  45.  
  46.            
  47.         }
  48.  
  49.         private void button1_Click(object sender, EventArgs e)
  50.         {
  51.  
  52.             DialogResult result = openFileDialog2.ShowDialog();
  53.  
  54.             openFileDialog2.Filter = ".exe files (*.pck) | *.pck;";
  55.  
  56.  
  57.             if (result == DialogResult.OK)
  58.             {
  59.                 //
  60.                 // The user selected a folder and pressed the OK button.
  61.                 // sPCK location will be used for command execution.
  62.                 //
  63.                 Properties.Settings.Default.pckFile = openFileDialog2.FileName;
  64.                 Properties.Settings.Default.Save();
  65.                
  66.  
  67.             }
  68.         }
  69.  
  70.  
  71.  
  72.         private void button2_Click(object sender, EventArgs e)
  73.         {
  74.            
  75.             if (actSel.SelectedItem.ToString() == "Extract")
  76.             {
  77.                
  78.                 System.Diagnostics.Process TheProcess = new System.Diagnostics.Process();
  79.                 var _with1 = TheProcess.StartInfo;
  80.                 var workingFolder = Properties.Settings.Default.pckPath;
  81.  
  82.                 _with1.WorkingDirectory = workingFolder;
  83.                 _with1.UseShellExecute = false;
  84.                 _with1.CreateNoWindow = false;
  85.                 _with1.Arguments = " " + gameSel.SelectedItem.ToString() + " -x " + listBox1.SelectedItem.ToString();
  86.                 TheProcess.StartInfo.FileName = workingFolder + @"\spck.exe";
  87.                 TheProcess.Start();
  88.  
  89.             }
  90.             else
  91.  
  92.                 if (actSel.SelectedItem.ToString() == "Compile")
  93.                 {
  94.                    
  95.                    
  96.                     System.Diagnostics.Process TheProcess = new System.Diagnostics.Process();
  97.                     var workingFolder = Properties.Settings.Default.pckPath;
  98.                     var _with1 = TheProcess.StartInfo;
  99.                     _with1.UseShellExecute = false;
  100.                     _with1.CreateNoWindow = false;
  101.                     _with1.WorkingDirectory = workingFolder;
  102.                     _with1.Arguments = " " + gameSel.SelectedItem.ToString() + " -c " + listBox2.SelectedItem.ToString();
  103.                     TheProcess.StartInfo.FileName = workingFolder + @"\spck.exe";
  104.                     TheProcess.Start();
  105.  
  106.                 }
  107.  
  108.         }
  109.  
  110.  
  111.  
  112.         private void button3_Click(object sender, EventArgs e)
  113.         {
  114.             string folderpath = "";
  115.             FolderBrowserDialog fbd = new FolderBrowserDialog();
  116.             DialogResult dr = fbd.ShowDialog();
  117.  
  118.             if (dr == DialogResult.OK)
  119.             {
  120.                 Properties.Settings.Default.pckPath = folderpath = fbd.SelectedPath;
  121.                 Properties.Settings.Default.Save();
  122.                 textBox2.Text = Properties.Settings.Default.pckPath;
  123.             }
  124.             // find the .pck files
  125.  
  126.             string folder = @"" + Properties.Settings.Default.pckPath;
  127.             string[] pckFiles = Directory.GetFiles(folder, "*.pck");
  128.             listBox1.Items.AddRange(pckFiles);
  129.  
  130.             // find the .list folders
  131.             string path = @"" + Properties.Settings.Default.pckPath;
  132.             string[] dirs = Directory.GetDirectories(path);
  133.             foreach (string dir in dirs)
  134.                 listBox2.Items.Add(dir);
  135.  
  136.  
  137.             if (folderpath != "please specify folder for pck") ;
  138.  
  139.  
  140.         }
  141.  
  142.         private void textBox1_TextChanged(object sender, EventArgs e)
  143.         {
  144.             string selected = listBox1.GetItemText(listBox1.SelectedValue);
  145.            
  146.         }
  147.  
  148.     }
  149.  
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement