-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainForm.cs
More file actions
77 lines (70 loc) · 2.38 KB
/
MainForm.cs
File metadata and controls
77 lines (70 loc) · 2.38 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
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MetroFramework;
using MetroFramework.Forms;
using MetroFramework.Controls;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.Reflection;
namespace BinarySerializationEditor
{
public partial class MainForm : MetroForm
{
BinaryFormatter formatter = new BinaryFormatter();
Display display = null;
public MainForm()
{
InitializeComponent();
}
private void chooseFileBtn_Click(object sender, EventArgs e)
{
chooseFile.ShowDialog(this);
}
private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
{
display = new Display(this, chooseFile.FileName);
}
private void openDLL_FileOk(object sender, CancelEventArgs e)
{
string path = Path.GetDirectoryName(openDLL.FileName);
foreach (string f in Directory.GetFiles(path))
{
// Load all dlls in folder, to make sure no dependencies are lost (dunno if this is even useful. oh well)
if (f.EndsWith(".dll") && !f.ToLower().Contains("firstpass")) // Get only dlls, and ignore unity's weird firstpass dll
{
AppDomain.CurrentDomain.AssemblyResolve += new AssemblyResolver(Path.GetFileNameWithoutExtension(f) , f).AssemblyResolve;
}
}
}
private void loadDLLBtn_Click(object sender, EventArgs e)
{
openDLL.ShowDialog(this);
}
private void metroButton1_Click(object sender, EventArgs e)
{
if (display == null)
{
MessageBox.Show(this, "You need to deserialize a binary file first!", "No Loaded Data");
return;
}
saveDialog.ShowDialog(this);
}
private void saveDialog_FileOk(object sender, CancelEventArgs e)
{
display.Save(saveDialog.FileName);
}
private void backButton_Click(object sender, EventArgs e)
{
display.currentElement = display.currentElement.parent;
display.DisplayElement();
}
}
}