2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using CodeImp.DoomBuilder.Data;
|
2022-09-18 17:54:53 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Config;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using CodeImp.DoomBuilder.ZDoom;
|
|
|
|
|
using System.Threading;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Windows
|
|
|
|
|
{
|
|
|
|
|
internal partial class ResourceOptionsForm : DelayedForm
|
|
|
|
|
{
|
|
|
|
|
// Variables
|
|
|
|
|
private DataLocation res;
|
2018-07-13 04:56:13 +00:00
|
|
|
|
private string startPath;
|
|
|
|
|
private Controls.FolderSelectDialog dirdialog;
|
2022-09-18 17:54:53 +00:00
|
|
|
|
private List<string> requiredarchives;
|
2018-07-13 04:56:13 +00:00
|
|
|
|
|
|
|
|
|
// Properties
|
|
|
|
|
public DataLocation ResourceLocation { get { return res; } }
|
2022-09-18 17:54:53 +00:00
|
|
|
|
public GameConfiguration GameConfiguration { get; set; }
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
private bool _ischeckingrequiredarchives = false;
|
|
|
|
|
private bool IsCheckingRequiredArchives
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _ischeckingrequiredarchives;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value)
|
|
|
|
|
{
|
|
|
|
|
apply.Enabled = false;
|
|
|
|
|
cancel.Enabled = false;
|
|
|
|
|
notfortesting.Enabled = false;
|
|
|
|
|
dir_textures.Enabled = false;
|
|
|
|
|
dir_flats.Enabled = false;
|
|
|
|
|
ControlBox = false;
|
|
|
|
|
checkingloader.Visible = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
apply.Enabled = true;
|
|
|
|
|
cancel.Enabled = true;
|
|
|
|
|
notfortesting.Enabled = true;
|
|
|
|
|
dir_textures.Enabled = true;
|
|
|
|
|
dir_flats.Enabled = true;
|
|
|
|
|
ControlBox = true;
|
|
|
|
|
checkingloader.Visible = false;
|
|
|
|
|
}
|
|
|
|
|
_ischeckingrequiredarchives = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
// Constructor
|
2013-03-18 13:52:27 +00:00
|
|
|
|
public ResourceOptionsForm(DataLocation settings, string caption, string startPath) //mxd. added startPath
|
2009-04-19 18:07:22 +00:00
|
|
|
|
{
|
|
|
|
|
// Initialize
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
// Set caption
|
|
|
|
|
this.Text = caption;
|
2022-09-18 17:54:53 +00:00
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
this.requiredarchives = new List<string>();
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
// Apply settings from ResourceLocation
|
|
|
|
|
this.res = settings;
|
|
|
|
|
switch(res.type)
|
|
|
|
|
{
|
|
|
|
|
// Setup for WAD File
|
|
|
|
|
case DataLocation.RESOURCE_WAD:
|
|
|
|
|
wadlocation.Text = res.location;
|
|
|
|
|
strictpatches.Checked = res.option1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// Setup for Directory
|
|
|
|
|
case DataLocation.RESOURCE_DIRECTORY:
|
|
|
|
|
dirlocation.Text = res.location;
|
|
|
|
|
dir_textures.Checked = res.option1;
|
|
|
|
|
dir_flats.Checked = res.option2;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// Setup for PK3 File
|
|
|
|
|
case DataLocation.RESOURCE_PK3:
|
|
|
|
|
pk3location.Text = res.location;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-07-02 14:15:47 +00:00
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
// Select appropriate tab
|
|
|
|
|
tabs.SelectedIndex = res.type;
|
2009-07-02 14:15:47 +00:00
|
|
|
|
|
|
|
|
|
// Checkbox
|
|
|
|
|
notfortesting.Checked = res.notfortesting;
|
2012-09-26 00:04:17 +00:00
|
|
|
|
|
2018-07-13 04:56:13 +00:00
|
|
|
|
this.startPath = startPath;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
2022-09-18 17:54:53 +00:00
|
|
|
|
|
|
|
|
|
protected override void OnClosing(CancelEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnClosing(e);
|
|
|
|
|
if (IsCheckingRequiredArchives) e.Cancel = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<string> CheckRequiredArchives(GameConfiguration config, DataLocation loc, CancellationToken token)
|
|
|
|
|
{
|
2022-09-26 20:45:19 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
General.WriteLogLine(string.Format("CheckRequiredArchives (Config = {0})", config?.Name));
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-09-18 17:54:53 +00:00
|
|
|
|
if (config == null)
|
|
|
|
|
return new List<string>();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DataReader dr = null;
|
|
|
|
|
List<string> requiredarchives = new List<string>();
|
|
|
|
|
HashSet<string> classes = null;
|
|
|
|
|
|
|
|
|
|
switch (loc.type)
|
|
|
|
|
{
|
|
|
|
|
case DataLocation.RESOURCE_WAD:
|
|
|
|
|
dr = new WADReader(loc, config, true) { Silent = true };
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DataLocation.RESOURCE_DIRECTORY:
|
|
|
|
|
dr = new DirectoryReader(loc, config, true) { Silent = true };
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DataLocation.RESOURCE_PK3:
|
|
|
|
|
dr = new PK3Reader(loc, config, true) { Silent = true };
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
token.ThrowIfCancellationRequested();
|
|
|
|
|
|
|
|
|
|
foreach (var arc in config.RequiredArchives)
|
|
|
|
|
{
|
|
|
|
|
bool found = true;
|
|
|
|
|
|
|
|
|
|
token.ThrowIfCancellationRequested();
|
|
|
|
|
|
|
|
|
|
foreach (RequiredArchiveEntry e in arc.Entries)
|
|
|
|
|
{
|
|
|
|
|
token.ThrowIfCancellationRequested();
|
|
|
|
|
|
|
|
|
|
if (e.Class != null)
|
|
|
|
|
{
|
|
|
|
|
if (classes == null)
|
|
|
|
|
{
|
|
|
|
|
classes = new HashSet<string>();
|
|
|
|
|
|
|
|
|
|
// load ZScript
|
|
|
|
|
var zscript = new ZScriptParser {
|
|
|
|
|
NoWarnings = true,
|
|
|
|
|
OnInclude = (parser, location) => {
|
|
|
|
|
IEnumerable<TextResourceData> includeStreams = dr.GetZScriptData(location);
|
|
|
|
|
foreach (TextResourceData data in includeStreams)
|
|
|
|
|
{
|
|
|
|
|
// Parse this data
|
|
|
|
|
parser.Parse(data, false);
|
|
|
|
|
|
|
|
|
|
//mxd. DECORATE lumps are interdepandable. Can't carry on...
|
|
|
|
|
if (parser.HasError)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
foreach (TextResourceData data in dr.GetZScriptData("ZSCRIPT"))
|
|
|
|
|
{
|
|
|
|
|
// Parse the data
|
|
|
|
|
data.Stream.Seek(0, SeekOrigin.Begin);
|
|
|
|
|
zscript.Parse(data, true);
|
|
|
|
|
|
|
|
|
|
if (zscript.HasError)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
foreach (string cls in zscript.LastClasses)
|
|
|
|
|
classes.Add(cls.ToLowerInvariant());
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-26 20:45:19 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
if (zscript.HasError)
|
|
|
|
|
General.WriteLogLine(string.Format("CRA({0}): ZScript error: {1}", loc.location, zscript.ErrorDescription));
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-09-18 17:54:53 +00:00
|
|
|
|
// load DECORATE
|
|
|
|
|
var decorate = new DecorateParser(zscript.AllActorsByClass) {
|
|
|
|
|
NoWarnings = true,
|
|
|
|
|
OnInclude = (parser, location) => {
|
|
|
|
|
IEnumerable<TextResourceData> includeStreams = dr.GetDecorateData(location);
|
|
|
|
|
foreach (TextResourceData data in includeStreams)
|
|
|
|
|
{
|
|
|
|
|
// Parse this data
|
|
|
|
|
parser.Parse(data, false);
|
|
|
|
|
|
|
|
|
|
//mxd. DECORATE lumps are interdepandable. Can't carry on...
|
|
|
|
|
if (parser.HasError)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
foreach (TextResourceData data in dr.GetDecorateData("DECORATE"))
|
|
|
|
|
{
|
|
|
|
|
// Parse the data
|
|
|
|
|
data.Stream.Seek(0, SeekOrigin.Begin);
|
|
|
|
|
decorate.Parse(data, true);
|
|
|
|
|
|
|
|
|
|
if (decorate.HasError)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
foreach (string cls in decorate.LastClasses)
|
|
|
|
|
classes.Add(cls.ToLowerInvariant());
|
|
|
|
|
}
|
2022-09-26 20:45:19 +00:00
|
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
|
if (decorate.HasError)
|
|
|
|
|
General.WriteLogLine(string.Format("CRA({0}): DECORATE error: {1}", loc.location, decorate.ErrorDescription));
|
|
|
|
|
#endif
|
2022-09-18 17:54:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!classes.Contains(e.Class.ToLowerInvariant()))
|
|
|
|
|
{
|
2022-09-26 20:45:19 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
General.WriteLogLine(string.Format("CRA({2}): Does not contain class: {1} <- {0}", string.Join(",", classes), e.Class, loc.location));
|
|
|
|
|
#endif
|
2022-09-18 17:54:53 +00:00
|
|
|
|
found = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.Lump != null && !dr.FileExists(e.Lump))
|
|
|
|
|
{
|
2022-09-26 20:45:19 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
General.WriteLogLine(string.Format("CRA({1}): Does not contain lump: {0}", e.Lump, loc.location));
|
|
|
|
|
#endif
|
2022-09-18 17:54:53 +00:00
|
|
|
|
found = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (found)
|
|
|
|
|
{
|
|
|
|
|
requiredarchives.Add(arc.ID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dr.Dispose();
|
|
|
|
|
|
|
|
|
|
return requiredarchives;
|
|
|
|
|
}
|
|
|
|
|
catch (OperationCanceledException)
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
General.WriteLogLine(e.ToString());
|
|
|
|
|
return new List<string>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<string> RunCheckRequiredArchives()
|
|
|
|
|
{
|
|
|
|
|
// thanks ms for making this a struct
|
|
|
|
|
CancellationTokenSource dummySource = new CancellationTokenSource();
|
|
|
|
|
List<string> output = CheckRequiredArchives(GameConfiguration, ToDataLocation(), dummySource.Token);
|
|
|
|
|
dummySource.Dispose();
|
|
|
|
|
return output;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-26 20:45:19 +00:00
|
|
|
|
private async void StartRequiredArchivesCheck()
|
2022-09-18 17:54:53 +00:00
|
|
|
|
{
|
|
|
|
|
IsCheckingRequiredArchives = true;
|
2022-09-26 20:45:19 +00:00
|
|
|
|
|
|
|
|
|
try
|
2022-09-18 17:54:53 +00:00
|
|
|
|
{
|
2022-09-26 20:45:19 +00:00
|
|
|
|
requiredarchives = await Task.Run(() => RunCheckRequiredArchives());
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
requiredarchives = new List<string>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ApplyDefaultRequiredArchivesSetting();
|
|
|
|
|
|
|
|
|
|
IsCheckingRequiredArchives = false;
|
2022-09-18 17:54:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ApplyDefaultRequiredArchivesSetting()
|
|
|
|
|
{
|
|
|
|
|
dir_textures.Checked = false;
|
|
|
|
|
dir_flats.Checked = false;
|
|
|
|
|
notfortesting.Checked = false;
|
|
|
|
|
// if any of the detected required archives implies "not for testing" <20> disable it by default
|
|
|
|
|
foreach (var arc in GameConfiguration.RequiredArchives)
|
|
|
|
|
{
|
|
|
|
|
if (requiredarchives.Contains(arc.ID) && arc.ExcludeFromTesting)
|
|
|
|
|
notfortesting.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DataLocation ToDataLocation()
|
|
|
|
|
{
|
|
|
|
|
DataLocation res = new DataLocation();
|
|
|
|
|
res.location = "";
|
|
|
|
|
res.requiredarchives = requiredarchives;
|
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
// Apply settings to ResourceLocation
|
2022-09-18 17:54:53 +00:00
|
|
|
|
switch (tabs.SelectedIndex)
|
2009-04-19 18:07:22 +00:00
|
|
|
|
{
|
|
|
|
|
// Setup WAD File
|
|
|
|
|
case DataLocation.RESOURCE_WAD:
|
|
|
|
|
|
|
|
|
|
// Check if file is specified
|
2022-09-18 17:54:53 +00:00
|
|
|
|
if ((wadlocation.Text.Length == 0) ||
|
2009-04-19 18:07:22 +00:00
|
|
|
|
(!File.Exists(wadlocation.Text)))
|
|
|
|
|
{
|
2022-09-18 17:54:53 +00:00
|
|
|
|
break;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Apply settings
|
|
|
|
|
res.type = DataLocation.RESOURCE_WAD;
|
|
|
|
|
res.location = wadlocation.Text;
|
|
|
|
|
res.option1 = strictpatches.Checked;
|
|
|
|
|
res.option2 = false;
|
2009-07-02 14:15:47 +00:00
|
|
|
|
res.notfortesting = notfortesting.Checked;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// Setup Directory
|
|
|
|
|
case DataLocation.RESOURCE_DIRECTORY:
|
|
|
|
|
|
|
|
|
|
// Check if directory is specified
|
2022-09-18 17:54:53 +00:00
|
|
|
|
if ((dirlocation.Text.Length == 0) ||
|
2009-04-19 18:07:22 +00:00
|
|
|
|
(!Directory.Exists(dirlocation.Text)))
|
|
|
|
|
{
|
2022-09-18 17:54:53 +00:00
|
|
|
|
break;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Apply settings
|
|
|
|
|
res.type = DataLocation.RESOURCE_DIRECTORY;
|
|
|
|
|
res.location = dirlocation.Text;
|
|
|
|
|
res.option1 = dir_textures.Checked;
|
|
|
|
|
res.option2 = dir_flats.Checked;
|
2009-07-02 14:15:47 +00:00
|
|
|
|
res.notfortesting = notfortesting.Checked;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2022-09-18 17:54:53 +00:00
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
// Setup PK3 File
|
|
|
|
|
case DataLocation.RESOURCE_PK3:
|
|
|
|
|
|
|
|
|
|
// Check if file is specified
|
2022-09-18 17:54:53 +00:00
|
|
|
|
if ((pk3location.Text.Length == 0) ||
|
2009-04-19 18:07:22 +00:00
|
|
|
|
(!File.Exists(pk3location.Text)))
|
|
|
|
|
{
|
2022-09-18 17:54:53 +00:00
|
|
|
|
break;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Apply settings
|
|
|
|
|
res.type = DataLocation.RESOURCE_PK3;
|
|
|
|
|
res.location = pk3location.Text;
|
|
|
|
|
res.option1 = false;
|
|
|
|
|
res.option2 = false;
|
2009-07-02 14:15:47 +00:00
|
|
|
|
res.notfortesting = notfortesting.Checked;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-09-18 17:54:53 +00:00
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// OK clicked
|
|
|
|
|
private void apply_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
res = ToDataLocation();
|
|
|
|
|
if (res.location == "")
|
|
|
|
|
{
|
|
|
|
|
switch (tabs.SelectedIndex)
|
|
|
|
|
{
|
|
|
|
|
case DataLocation.RESOURCE_WAD:
|
|
|
|
|
MessageBox.Show(this, "Please select a valid WAD File resource.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DataLocation.RESOURCE_PK3:
|
|
|
|
|
MessageBox.Show(this, "Please select a valid PK3 or PK7 File resource.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DataLocation.RESOURCE_DIRECTORY:
|
|
|
|
|
MessageBox.Show(this, "Please select a valid directory resource.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
2009-07-02 14:15:47 +00:00
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
|
// Cancel clicked
|
|
|
|
|
private void cancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Just hide
|
|
|
|
|
this.DialogResult = DialogResult.Cancel;
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Browse WAD File clicked
|
|
|
|
|
private void browsewad_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Browse for WAD File
|
|
|
|
|
if(wadfiledialog.ShowDialog(this) == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
// Use this file
|
|
|
|
|
wadlocation.Text = wadfiledialog.FileName;
|
2022-09-18 17:54:53 +00:00
|
|
|
|
StartRequiredArchivesCheck();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Browse Directory clicked
|
|
|
|
|
private void browsedir_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2018-07-13 04:56:13 +00:00
|
|
|
|
// Browse for Directory
|
|
|
|
|
dirdialog = new Controls.FolderSelectDialog();
|
|
|
|
|
dirdialog.Title = "Select Resource Folder";
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(dirlocation.Text) || !Directory.Exists(dirlocation.Text))
|
|
|
|
|
{
|
|
|
|
|
//mxd
|
|
|
|
|
if (!string.IsNullOrEmpty(startPath))
|
|
|
|
|
{
|
|
|
|
|
string startDir = Path.GetDirectoryName(startPath);
|
|
|
|
|
if (Directory.Exists(startDir)) dirdialog.InitialDirectory = startDir + '\\';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dirdialog.InitialDirectory = dirlocation.Text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dirdialog.ShowDialog(this.Handle))
|
2009-04-19 18:07:22 +00:00
|
|
|
|
{
|
2018-07-13 04:56:13 +00:00
|
|
|
|
// Use this directory
|
|
|
|
|
dirlocation.Text = dirdialog.FileName;
|
2022-09-18 17:54:53 +00:00
|
|
|
|
StartRequiredArchivesCheck();
|
2018-07-13 04:56:13 +00:00
|
|
|
|
dirdialog = null;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Browse PK3 File clicked
|
|
|
|
|
private void browsepk3_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Browse for PK3 File
|
|
|
|
|
if(pk3filedialog.ShowDialog(this) == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
// Use this file
|
|
|
|
|
pk3location.Text = pk3filedialog.FileName;
|
2022-09-18 17:54:53 +00:00
|
|
|
|
StartRequiredArchivesCheck();
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Link clicked
|
|
|
|
|
private void link_Click(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
{
|
2015-01-06 11:49:06 +00:00
|
|
|
|
General.OpenWebsite("http://www.zdoom.org/wiki/Using_ZIPs_as_WAD_replacement");
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Help
|
|
|
|
|
private void ResourceOptionsForm_HelpRequested(object sender, HelpEventArgs hlpevent)
|
|
|
|
|
{
|
|
|
|
|
General.ShowHelp("w_resourceoptions.html");
|
|
|
|
|
hlpevent.Handled = true;
|
|
|
|
|
}
|
2022-10-20 18:40:07 +00:00
|
|
|
|
|
|
|
|
|
private void wadlocation_Enter(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Stop textbox control from getting focus
|
|
|
|
|
browsewad.Focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void dirlocation_Enter(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Stop textbox control from getting focus
|
|
|
|
|
browsedir.Focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void pk3location_Enter(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Stop textbox control from getting focus
|
|
|
|
|
browsepk3.Focus();
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
}
|