Skip to content

Commit fea640b

Browse files
committed
29/05/2024 - 00
Frameworks and dependencies are updated! MySQL Import and Export Fixed!
1 parent d34cee1 commit fea640b

18 files changed

+315
-154
lines changed

AdvancedDataGridView/AdvancedDataGridView.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<AppDesignerFolder>Properties</AppDesignerFolder>
1111
<RootNamespace>ADGV</RootNamespace>
1212
<AssemblyName>AdvancedDataGridView</AssemblyName>
13-
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
13+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1414
<FileAlignment>512</FileAlignment>
1515
<SccProjectName>SAK</SccProjectName>
1616
<SccLocalPath>SAK</SccLocalPath>

AdvancedDataGridView/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,41 @@ This means any and all contribution in the form of commits, change requests, iss
4747
### Credits:
4848
Credits go to Ladislav Zezula for the awesome StormLib and thanks to all those that contribute to the WoWDev wiki.
4949
I've also patched the definitions together for various sources across the internet, there are too many to name, but thanks to all.
50+
51+
### MySQL Setup:
52+
LOAD DATA LOCAL INFILE is not enabled by default.Normally, it should be enabled by placing local-infile=1 in my.cnf. But it does not work for all installations.
53+
Connect to your server using MySQL or any console client using the following command:
54+
```
55+
mysql -u root -p
56+
```
57+
It should echo the following:
58+
```
59+
Enter password:
60+
```
61+
Now you have to enter your root password.
62+
After you are connected, paste the following command:
63+
```
64+
SHOW GLOBAL VARIABLES LIKE 'local_infile';
65+
```
66+
It should echo the following:
67+
```
68+
+---------------+-------+
69+
| Variable_name | Value |
70+
+---------------+-------+
71+
| local_infile | OFF |
72+
+---------------+-------+
73+
1 row in set (0.00 sec)
74+
```
75+
If local_infile = OFF, you need to paste the following command, otherwise if it is ON, you are good to go!
76+
```
77+
SET GLOBAL local_infile = 'ON'
78+
```
79+
It should echo the following:
80+
```
81+
+---------------+-------+
82+
| Variable_name | Value |
83+
+---------------+-------+
84+
| local_infile | ON |
85+
+---------------+-------+
86+
1 row in set (0.00 sec)
87+
```

WDBXEditor/App.config

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</sectionGroup>
77
</configSections>
88
<startup>
9-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
9+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
1010
</startup>
1111
<appSettings>
1212
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
@@ -55,10 +55,60 @@
5555
</providers>
5656
</roleManager>
5757
</system.web>
58-
<system.data>
59-
<DbProviderFactories>
60-
<remove invariant="MySql.Data.MySqlClient" />
61-
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
62-
</DbProviderFactories>
63-
</system.data>
64-
</configuration>
58+
59+
<runtime>
60+
61+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
62+
63+
<dependentAssembly>
64+
65+
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
66+
67+
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
68+
69+
</dependentAssembly>
70+
71+
<dependentAssembly>
72+
73+
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
74+
75+
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
76+
77+
</dependentAssembly>
78+
79+
<dependentAssembly>
80+
81+
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
82+
83+
<bindingRedirect oldVersion="0.0.0.0-3.27.0.0" newVersion="3.27.0.0" />
84+
85+
</dependentAssembly>
86+
87+
<dependentAssembly>
88+
89+
<assemblyIdentity name="ZstdSharp" publicKeyToken="8d151af33a4ad5cf" culture="neutral" />
90+
91+
<bindingRedirect oldVersion="0.0.0.0-0.8.1.0" newVersion="0.8.1.0" />
92+
93+
</dependentAssembly>
94+
95+
<dependentAssembly>
96+
97+
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
98+
99+
<bindingRedirect oldVersion="0.0.0.0-1.3.8.0" newVersion="1.3.8.0" />
100+
101+
</dependentAssembly>
102+
103+
<dependentAssembly>
104+
105+
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
106+
107+
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
108+
109+
</dependentAssembly>
110+
111+
</assemblyBinding>
112+
113+
</runtime>
114+
</configuration>

WDBXEditor/Common/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public enum ImportFlags
6464
TakeNewest
6565
}
6666

67-
public enum CompressionType
67+
public enum CompressionTypeWDBX
6868
{
6969
None = 0,
7070
Immediate = 1,

WDBXEditor/Forms/LegionParser.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,12 @@ private void ParseWDC1(MemoryStream stream, string file)
322322
continue;
323323
}
324324

325-
if (header.ColumnMeta[f].CompressionType == CompressionType.None)
325+
if (header.ColumnMeta[f].CompressionTypeWDBX == CompressionTypeWDBX.None)
326326
{
327327
int bitSize = header.FieldStructure[f].BitCount;
328328
byteType = FieldTypes[NextPow2(~~(bitSize + 7) / 8)];
329329
}
330-
else if (header.ColumnMeta[f].CompressionType > CompressionType.Immediate)
330+
else if (header.ColumnMeta[f].CompressionTypeWDBX > CompressionTypeWDBX.Immediate)
331331
{
332332
byteType = FieldType.INT;
333333
}
@@ -400,7 +400,7 @@ private void ParseWDC1(MemoryStream stream, string file)
400400
fields[i].Type = FieldType.FLOAT;
401401
else if (options.Contains(FieldType.STRING))
402402
fields[i].Type = FieldType.STRING;
403-
else if (header.ColumnMeta[i].CompressionType == CompressionType.Immediate && header.ColumnMeta[i].Cardinality == 0)
403+
else if (header.ColumnMeta[i].CompressionTypeWDBX == CompressionTypeWDBX.Immediate && header.ColumnMeta[i].Cardinality == 0)
404404
fields[i].Type = FieldType.UINT;
405405
else
406406
fields[i].Type = FieldType.INT;

WDBXEditor/Forms/LoadSQL.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
using System.Threading.Tasks;
1212
using System.Windows.Forms;
1313
using static WDBXEditor.Common.Constants;
14+
using MySqlX.XDevAPI.Relational;
1415

1516
namespace WDBXEditor
1617
{
1718
public partial class LoadSQL : Form
1819
{
19-
public string ConnectionString => $"Server={txtHost.Text};Port={txtPort.Text};Database={ddlDatabases.Text};Uid={txtUser.Text};Pwd={txtPass.Text};";
20+
public string ConnectionString => $"Server={txtHost.Text};Port={txtPort.Text};Database={ddlDatabases.Text};Uid={txtUser.Text};Pwd={txtPass.Text};AllowLoadLocalInfile=true;";
2021
public bool ConnectionOnly { get; set; } = false;
2122
public DBEntry Entry { get; set; }
2223
public string ErrorMessage = string.Empty;
@@ -143,16 +144,19 @@ private void ddlDatabases_SelectedIndexChanged(object sender, EventArgs e)
143144
using (MySqlConnection connection = new MySqlConnection(ConnectionString))
144145
{
145146
connection.Open();
146-
MySqlCommand command = new MySqlCommand($"USE {ddlDatabases.Text}; SHOW TABLES;", connection);
147-
using (var rdr = command.ExecuteReader())
147+
//string sql = $"SELECT table_name FROM information_schema.tables WHERE table_schema = {ddlDatabases.Text}";
148+
string sql = $"USE {ddlDatabases.Text}; SHOW TABLES;";
149+
MySqlCommand command = new MySqlCommand(sql, connection);
150+
using (var reader = command.ExecuteReader())
148151
{
149-
ddlTable.Items.Add("");
150-
while (rdr.Read())
151-
ddlTable.Items.Add(rdr[0].ToString());
152+
while (reader.Read())
153+
{
154+
ddlTable.Items.Add(reader.GetString(0));
155+
}
152156
}
153157
}
154158
}
155-
catch { return; }
159+
catch(Exception ex) { MessageBox.Show(ex.Message); return; }
156160
}
157161

158162
btnLoad.Enabled = !string.IsNullOrWhiteSpace(ddlDatabases.Text) && //Database selected

WDBXEditor/Forms/WotLKItemFix.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Threading.Tasks;
1111
using System.Windows.Forms;
1212
using static WDBXEditor.Common.Constants;
13+
using MySqlX.XDevAPI.Relational;
1314

1415
namespace WDBXEditor
1516
{
@@ -109,15 +110,17 @@ private void ddlDatabases_SelectedIndexChanged(object sender, EventArgs e)
109110
{
110111
connection.Open();
111112
MySqlCommand command = new MySqlCommand(sql, connection);
112-
using (var rdr = command.ExecuteReader())
113-
{
114-
ddlTable.Items.Add("");
115-
while (rdr.Read())
116-
ddlTable.Items.Add(rdr[0].ToString());
113+
using (MySqlDataReader reader = command.ExecuteReader())
114+
{
115+
while (reader.Read())
116+
{
117+
ddlTable.Items.Add(reader.GetString(0));
118+
MessageBox.Show(reader.GetString(0));
119+
}
117120
}
118121
}
119122
}
120-
catch { return; }
123+
catch (Exception ex) { MessageBox.Show(ex.Message); }
121124
}
122125

123126
btnLoad.Enabled = !string.IsNullOrWhiteSpace(ddlDatabases.Text) && //Database selected

WDBXEditor/Main.cs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -641,17 +641,25 @@ private void toSQLToolStripMenuItem_Click(object sender, EventArgs e)
641641
{
642642
if (sql.ShowDialog(this) == DialogResult.OK)
643643
{
644-
ProgressBarHandle(true, "Exporting to SQL...");
645-
Task.Factory.StartNew(() => { LoadedEntry.ToSQLTable(sql.ConnectionString); })
646-
.ContinueWith(x =>
644+
try
647645
{
648-
if (x.IsFaulted)
649-
MessageBox.Show("An error occured exporting to SQL.");
650-
else
651-
MessageBox.Show("Sucessfully exported to SQL.");
652-
653-
ProgressBarHandle(false);
654-
}, TaskScheduler.FromCurrentSynchronizationContext());
646+
ProgressBarHandle(true, "Exporting to SQL...");
647+
Task.Factory.StartNew(() => { LoadedEntry.ToSQLTable(sql.ConnectionString); })
648+
.ContinueWith(x =>
649+
{
650+
if (x.IsFaulted)
651+
MessageBox.Show("An error occured exporting to SQL. ");
652+
else
653+
MessageBox.Show("Sucessfully exported to SQL.");
654+
655+
ProgressBarHandle(false);
656+
}, TaskScheduler.FromCurrentSynchronizationContext());
657+
}
658+
catch (Exception ex)
659+
{
660+
MessageBox.Show("An error occured exporting to SQL. " + ex.Message);
661+
}
662+
655663
}
656664
}
657665
}

WDBXEditor/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WDBXEditor/Properties/Settings.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WDBXEditor/Reader/ColumnStructureEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class ColumnStructureEntry
1212
public ushort RecordOffset { get; set; }
1313
public ushort Size { get; set; }
1414
public uint AdditionalDataSize { get; set; }
15-
public CompressionType CompressionType { get; set; }
15+
public CompressionTypeWDBX CompressionTypeWDBX { get; set; }
1616
public int BitOffset { get; set; } // used as common data column for Sparse
1717
public int BitWidth { get; set; }
1818
public int Cardinality { get; set; } // flags for Immediate, &1: Signed

0 commit comments

Comments
 (0)