forked from ShrineFox/AtlusScriptGUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvents.cs
More file actions
127 lines (109 loc) · 3.75 KB
/
Events.cs
File metadata and controls
127 lines (109 loc) · 3.75 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using MetroSet_UI.Forms;
using ShrineFox.IO;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.NetworkInformation;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AtlusScriptGUI
{
public partial class MainForm : MetroSetForm
{
private void Btn_Click(object sender, EventArgs e)
{
var btn = (Button)sender;
bool decompile = btn.Name.Contains("Decompile");
string browseWindowTitle = "Choose .MSG/.FLOW to Compile";
if (decompile)
browseWindowTitle = "Choose .BMD/.BF to Decompile";
var files = WinFormsDialogs.SelectFile(browseWindowTitle, true);
Compile(files.ToArray(), decompile);
}
private void Btn_DragDrop(object sender, DragEventArgs e)
{
var btn = (Button)sender;
string[] fileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);
if (File.Exists(CompilerPath))
Compile(fileList, btn.Name.Contains("Decompile"));
else
MessageBox.Show("Could not find AtlusScriptCompiler.exe. " +
"Change the path in Config.json and try running this program again!",
"Critical Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
private void Btn_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Move;
}
private void OpenLog_Click(object sender, EventArgs e)
{
OpenLog();
}
private void Game_Changed(object sender, EventArgs e)
{
settings.Game = comboBox_Game.SelectedItem.ToString();
settings.SaveJson(settings);
SetEncodingDropDown();
}
private void Encoding_Changed(object sender, EventArgs e)
{
if (!comboBox_Encoding.Enabled)
return;
settings.Encoding = comboBox_Encoding.SelectedItem.ToString();
settings.SaveJson(settings);
}
private void VanillaText_Changed(object sender, EventArgs e)
{
try
{
string result = ConvertVanillaFlag(txtBox_Vanilla.Text);
if (result != "-1")
txtBox_Royal.Text = result;
else
txtBox_Royal.Text = txtBox_Vanilla.Text;
}
catch
{
txtBox_Royal.Text = "Out of Range";
}
}
private void RoyalText_Changed(object sender, EventArgs e)
{
try
{
string result = ConvertRoyalFlag(txtBox_Royal.Text);
if (result != "-1")
txtBox_Vanilla.Text = result;
else
txtBox_Vanilla.Text = txtBox_Royal.Text;
}
catch
{
txtBox_Vanilla.Text = "Out of Range";
}
}
private void Check_Changed(object sender, EventArgs e)
{
var item = (ToolStripMenuItem)sender;
if (!item.Enabled)
return;
settings.DeleteHeader = chk_DeleteHeader.Checked;
settings.Disassemble = chk_Disassemble.Checked;
settings.Hook = chk_Hook.Checked;
settings.Overwrite = chk_Overwrite.Checked;
settings.SumBits = chk_SumBits.Checked;
settings.SaveJson(settings);
}
private void ToggleTheme_Click(object sender, EventArgs e)
{
ToggleTheme();
ApplyTheme();
}
}
}