-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLocMergeForm.cs
More file actions
131 lines (120 loc) · 4.46 KB
/
Copy pathLocMergeForm.cs
File metadata and controls
131 lines (120 loc) · 4.46 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
128
129
130
131
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace LVLTool
{
public partial class LocMergeForm : Form
{
public LocMergeForm()
{
InitializeComponent();
}
//protected override void OnHandleCreated(EventArgs e)
//{
// //https://stackoverflow.com/questions/57124243/winforms-dark-title-bar-on-windows-10 (thank you:)
// if (DwmSetWindowAttribute(this.Handle, 19, new[] { 1 }, 4) != 0)
// DwmSetWindowAttribute(this.Handle, 20, new[] { 1 }, 4);
// base.OnHandleCreated(e);
//}
//[System.Runtime.InteropServices.DllImport("DwmApi")] //System.Runtime.InteropServices
//private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
private void mLVLFileTextBox_DragDrop(object sender, DragEventArgs e)
{
Control tb = sender as Control;
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if (files != null && files.Length == 1 && tb != null)
{
tb.Text = files[0];
}
mStatusLabel.Text = "";
}
private void mLVLFileTextBox_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
}
private void mAssetListBox_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
StringBuilder errList = new StringBuilder();
int lastSlash = 0;
if (files != null)
{
for (int i = 0; i < files.Length; i++)
{
if (!AddItem(files[i]))
{
lastSlash = files[i].LastIndexOf("\\") + 1;
if (lastSlash > 0)
{
errList.Append(" ");
errList.Append(files[i].Substring(lastSlash));
errList.Append("\n");
}
}
}
if (errList.Length > 0)
{
MessageBox.Show(String.Format(
"Error:\n{0} ???",
errList.ToString()));
}
}
mStatusLabel.Text = "";
}
public bool AddItem(string file)
{
mAssetListBox.Items.Add(file);
return true;
}
private void mMergeButton_Click(object sender, EventArgs e)
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.FileName = mLVLFileTextBox.Text;
if (dlg.ShowDialog() == DialogResult.OK)
{
CoreMerge cm = new CoreMerge(mLVLFileTextBox.Text);
foreach (object item in mAssetListBox.Items)
{
cm.GatherStrings(item.ToString());
}
cm.Save(dlg.FileName);
mStatusLabel.Text = "Saved to: " + dlg.FileName;
}
dlg.Dispose();
}
internal void SetStyle(Form prevForm)
{
this.BackColor = prevForm.BackColor;
this.ForeColor = prevForm.ForeColor;
TextBox tb = null;
Button b = null;
foreach (Control tmp in prevForm.Controls)
{
if (tb == null)
tb = tmp as TextBox;
if (b == null)
b = tmp as Button;
if (tb != null && b != null)
break;
}
if (tb != null)
{
this.mLVLFileTextBox.BackColor = this.mAssetListBox.BackColor = tb.BackColor;
this.mLVLFileTextBox.ForeColor = this.mAssetListBox.ForeColor = tb.ForeColor;
}
if (b != null)
{
mMergeButton.BackColor = mBrowseLVL.BackColor = b.BackColor;
mMergeButton.ForeColor = mBrowseLVL.ForeColor = b.ForeColor;
}
}
}
}