forked from Violet-CLM/MLLE
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSFXForm.cs
More file actions
69 lines (61 loc) · 2.35 KB
/
Copy pathSFXForm.cs
File metadata and controls
69 lines (61 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.IO;
using System.Text;
using System.Windows.Forms;
public partial class SFXForm : Form
{
public DialogResult result = DialogResult.Cancel;
public string[][] Paths = new string[48][];
private string[] resFilenames;
private string DefaultDirectory;
private Dictionary<string, VOres> VOFiles = new Dictionary<string, VOres>();
public SFXForm(string[][] p, string d)
{
Paths = p;
DefaultDirectory = d;
InitializeComponent();
}
private void SFXForm_Load(object sender, EventArgs e)
{
resFilenames = Directory.GetFiles(DefaultDirectory, "VO*.res");
for (int i = 0; i < resFilenames.Length; i++) Files.Items.Add(Path.GetFileNameWithoutExtension(resFilenames[i]));
}
private void ButtonOK_Click(object sender, EventArgs e) { result = DialogResult.OK; Close(); }
private void ButtonCancel_Click(object sender, EventArgs e) { Close(); }
private void InLevel_SelectedIndexChanged(object sender, EventArgs e)
{
if (Paths[InLevel.SelectedIndex] == null)
{
Files.SelectedIndex = 0;
}
else
{
Files.SelectedIndex = Files.FindStringExact(Paths[InLevel.SelectedIndex][0]);
Sounds.SelectedIndex = Sounds.FindStringExact(Paths[InLevel.SelectedIndex][1]);
}
}
private void Files_SelectedIndexChanged(object sender, EventArgs e)
{
Sounds.Items.Clear();
if (Files.SelectedIndex == 0)
{
Paths[InLevel.SelectedIndex] = null;
}
else
{
string fileName = resFilenames[Files.SelectedIndex - 1];
if (!VOFiles.ContainsKey(fileName)) VOFiles[fileName] = new VOres(fileName);
Sounds.Items.AddRange(VOFiles[fileName].SFXnames);
}
}
private void Sounds_SelectedIndexChanged(object sender, EventArgs e)
{
Paths[InLevel.SelectedIndex][0] = (string)Files.SelectedItem;
Paths[InLevel.SelectedIndex][1] = (string)Sounds.SelectedItem;
}
}