forked from Violet-CLM/MLLE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindParameterValues.cs
More file actions
72 lines (64 loc) · 2.26 KB
/
Copy pathFindParameterValues.cs
File metadata and controls
72 lines (64 loc) · 2.26 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
70
71
72
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MLLE
{
public partial class FindParameterValues : Form
{
public FindParameterValues()
{
InitializeComponent();
}
uint[,] EventMap;
string[][] EventStrings;
internal void ShowForm(ref uint[,] eventMap, string[][] eventStrings)
{
EventMap = eventMap;
EventStrings = eventStrings;
ShowDialog();
}
private void button1_Click(object sender, EventArgs e)
{
Close();
}
private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
var findParameterName = comboBox1.Text.Trim();
var parameterLocationsPerEvent = new int[256];
var foundValues = new SortedSet<int>();
if (findParameterName.Length > 0)
{
for (int eventID = 1; eventID < 256; ++eventID)
{
var ev = EventStrings[eventID];
for (int i = 5; i < ev.Length; ++i)
if (String.Equals(ev[i].Split(':')[0].Trim(), findParameterName, StringComparison.OrdinalIgnoreCase)) {
parameterLocationsPerEvent[eventID] = i - 4;
break;
}
}
}
foreach (var eventBits in EventMap) {
var eventID = eventBits & 0xFF;
if (parameterLocationsPerEvent[eventID] != 0)
foundValues.Add(Mainframe.ExtractParameterValues(eventBits, EventStrings[eventID])[parameterLocationsPerEvent[eventID] - 1]);
}
listBox1.Items.AddRange(foundValues.Select(val => val.ToString()).ToArray());
if (listBox1.Items.Count == 0)
ResultPrintout.Text = "(found no matches)";
else
{
int i;
for (i = 0; foundValues.Contains(i); ++i) ;
ResultPrintout.Text = "First free value: " + i.ToString();
}
}
}
}