Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace sPCK_GUI
- {
- public partial class mainForm : Form
- {
- public mainForm()
- {
- InitializeComponent();
- }
- private void mainForm_Load(object sender, EventArgs e)
- {
- if (Properties.Settings.Default.pckPath == null)
- {
- MessageBox.Show("warning! no path for .pck files found!");
- }
- else
- textBox2.Text = Properties.Settings.Default.pckPath;
- // find the .pck files
- string folder = @"" + Properties.Settings.Default.pckPath;
- string[] pckFiles = Directory.GetFiles(folder, "*.pck");
- listBox1.Items.AddRange(pckFiles);
- // find the .list folders
- string path = @"" + Properties.Settings.Default.pckPath;
- string[] dirs = Directory.GetDirectories(path);
- foreach (string dir in dirs)
- listBox2.Items.Add(dir);
- }
- private void button1_Click(object sender, EventArgs e)
- {
- DialogResult result = openFileDialog2.ShowDialog();
- openFileDialog2.Filter = ".exe files (*.pck) | *.pck;";
- if (result == DialogResult.OK)
- {
- //
- // The user selected a folder and pressed the OK button.
- // sPCK location will be used for command execution.
- //
- Properties.Settings.Default.pckFile = openFileDialog2.FileName;
- Properties.Settings.Default.Save();
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- if (actSel.SelectedItem.ToString() == "Extract")
- {
- System.Diagnostics.Process TheProcess = new System.Diagnostics.Process();
- var _with1 = TheProcess.StartInfo;
- var workingFolder = Properties.Settings.Default.pckPath;
- _with1.WorkingDirectory = workingFolder;
- _with1.UseShellExecute = false;
- _with1.CreateNoWindow = false;
- _with1.Arguments = " " + gameSel.SelectedItem.ToString() + " -x " + listBox1.SelectedItem.ToString();
- TheProcess.StartInfo.FileName = workingFolder + @"\spck.exe";
- TheProcess.Start();
- }
- else
- if (actSel.SelectedItem.ToString() == "Compile")
- {
- System.Diagnostics.Process TheProcess = new System.Diagnostics.Process();
- var workingFolder = Properties.Settings.Default.pckPath;
- var _with1 = TheProcess.StartInfo;
- _with1.UseShellExecute = false;
- _with1.CreateNoWindow = false;
- _with1.WorkingDirectory = workingFolder;
- _with1.Arguments = " " + gameSel.SelectedItem.ToString() + " -c " + listBox2.SelectedItem.ToString();
- TheProcess.StartInfo.FileName = workingFolder + @"\spck.exe";
- TheProcess.Start();
- }
- }
- private void button3_Click(object sender, EventArgs e)
- {
- string folderpath = "";
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- DialogResult dr = fbd.ShowDialog();
- if (dr == DialogResult.OK)
- {
- Properties.Settings.Default.pckPath = folderpath = fbd.SelectedPath;
- Properties.Settings.Default.Save();
- textBox2.Text = Properties.Settings.Default.pckPath;
- }
- // find the .pck files
- string folder = @"" + Properties.Settings.Default.pckPath;
- string[] pckFiles = Directory.GetFiles(folder, "*.pck");
- listBox1.Items.AddRange(pckFiles);
- // find the .list folders
- string path = @"" + Properties.Settings.Default.pckPath;
- string[] dirs = Directory.GetDirectories(path);
- foreach (string dir in dirs)
- listBox2.Items.Add(dir);
- if (folderpath != "please specify folder for pck") ;
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- string selected = listBox1.GetItemText(listBox1.SelectedValue);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement