2017-09-21 18:33:05 +08:00
|
|
|
|
using CodeWalker.Properties;
|
|
|
|
|
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.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace CodeWalker
|
|
|
|
|
{
|
|
|
|
|
public partial class SelectFolderForm : Form
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public string SelectedFolder { get; set; }
|
|
|
|
|
public DialogResult Result { get; set; } = DialogResult.Cancel;
|
|
|
|
|
|
|
|
|
|
public SelectFolderForm()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SelectFolderForm_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
2018-02-21 17:12:17 +08:00
|
|
|
|
FolderTextBox.Text = GTAFolder.CurrentGTAFolder;
|
2018-02-21 16:27:01 +08:00
|
|
|
|
RememberFolderCheckbox.Checked = Settings.Default.RememberGTAFolder;
|
2017-09-21 18:33:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FolderBrowseButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
FolderBrowserDialog.SelectedPath = FolderTextBox.Text;
|
|
|
|
|
DialogResult res = FolderBrowserDialog.ShowDialog();
|
|
|
|
|
if (res == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
FolderTextBox.Text = FolderBrowserDialog.SelectedPath;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FolderTextBox_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
SelectedFolder = FolderTextBox.Text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CancelButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OkButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2018-02-21 16:34:49 +08:00
|
|
|
|
if(!GTAFolder.ValidateGTAFolder(SelectedFolder, out string failReason))
|
2017-09-21 18:33:05 +08:00
|
|
|
|
{
|
2018-02-21 16:34:49 +08:00
|
|
|
|
MessageBox.Show("The selected folder could not be used:\n\n" + failReason, "Invalid GTA Folder", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
2017-09-21 18:33:05 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2018-02-21 16:34:49 +08:00
|
|
|
|
|
2017-09-21 18:33:05 +08:00
|
|
|
|
Result = DialogResult.OK;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
2018-02-21 16:27:01 +08:00
|
|
|
|
|
|
|
|
|
private void RememberFolderCheckbox_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Settings.Default.RememberGTAFolder = RememberFolderCheckbox.Checked;
|
|
|
|
|
}
|
2017-09-21 18:33:05 +08:00
|
|
|
|
}
|
|
|
|
|
}
|