Skip to content

29/05/2024 - 00 #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AdvancedDataGridView/AdvancedDataGridView.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ADGV</RootNamespace>
<AssemblyName>AdvancedDataGridView</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
Expand Down
2 changes: 1 addition & 1 deletion AdvancedDataGridView/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,41 @@ This means any and all contribution in the form of commits, change requests, iss
### Credits:
Credits go to Ladislav Zezula for the awesome StormLib and thanks to all those that contribute to the WoWDev wiki.
I've also patched the definitions together for various sources across the internet, there are too many to name, but thanks to all.

### MySQL Setup:
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.
Connect to your server using MySQL or any console client using the following command:
```
mysql -u root -p
```
It should echo the following:
```
Enter password:
```
Now you have to enter your root password.
After you are connected, paste the following command:
```
SHOW GLOBAL VARIABLES LIKE 'local_infile';
```
It should echo the following:
```
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | OFF |
+---------------+-------+
1 row in set (0.00 sec)
```
If local_infile = OFF, you need to paste the following command, otherwise if it is ON, you are good to go!
```
SET GLOBAL local_infile = 'ON'
```
It should echo the following:
```
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | ON |
+---------------+-------+
1 row in set (0.00 sec)
```
66 changes: 58 additions & 8 deletions WDBXEditor/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
Expand Down Expand Up @@ -55,10 +55,60 @@
</providers>
</roleManager>
</system.web>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<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" />
</DbProviderFactories>
</system.data>
</configuration>

<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

<dependentAssembly>

<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />

</dependentAssembly>

<dependentAssembly>

<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />

</dependentAssembly>

<dependentAssembly>

<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-3.27.0.0" newVersion="3.27.0.0" />

</dependentAssembly>

<dependentAssembly>

<assemblyIdentity name="ZstdSharp" publicKeyToken="8d151af33a4ad5cf" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-0.8.1.0" newVersion="0.8.1.0" />

</dependentAssembly>

<dependentAssembly>

<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-1.3.8.0" newVersion="1.3.8.0" />

</dependentAssembly>

<dependentAssembly>

<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />

</dependentAssembly>

</assemblyBinding>

</runtime>
</configuration>
2 changes: 1 addition & 1 deletion WDBXEditor/Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public enum ImportFlags
TakeNewest
}

public enum CompressionType
public enum CompressionTypeWDBX
{
None = 0,
Immediate = 1,
Expand Down
6 changes: 3 additions & 3 deletions WDBXEditor/Forms/LegionParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ private void ParseWDC1(MemoryStream stream, string file)
continue;
}

if (header.ColumnMeta[f].CompressionType == CompressionType.None)
if (header.ColumnMeta[f].CompressionTypeWDBX == CompressionTypeWDBX.None)
{
int bitSize = header.FieldStructure[f].BitCount;
byteType = FieldTypes[NextPow2(~~(bitSize + 7) / 8)];
}
else if (header.ColumnMeta[f].CompressionType > CompressionType.Immediate)
else if (header.ColumnMeta[f].CompressionTypeWDBX > CompressionTypeWDBX.Immediate)
{
byteType = FieldType.INT;
}
Expand Down Expand Up @@ -400,7 +400,7 @@ private void ParseWDC1(MemoryStream stream, string file)
fields[i].Type = FieldType.FLOAT;
else if (options.Contains(FieldType.STRING))
fields[i].Type = FieldType.STRING;
else if (header.ColumnMeta[i].CompressionType == CompressionType.Immediate && header.ColumnMeta[i].Cardinality == 0)
else if (header.ColumnMeta[i].CompressionTypeWDBX == CompressionTypeWDBX.Immediate && header.ColumnMeta[i].Cardinality == 0)
fields[i].Type = FieldType.UINT;
else
fields[i].Type = FieldType.INT;
Expand Down
18 changes: 11 additions & 7 deletions WDBXEditor/Forms/LoadSQL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
using System.Threading.Tasks;
using System.Windows.Forms;
using static WDBXEditor.Common.Constants;
using MySqlX.XDevAPI.Relational;

namespace WDBXEditor
{
public partial class LoadSQL : Form
{
public string ConnectionString => $"Server={txtHost.Text};Port={txtPort.Text};Database={ddlDatabases.Text};Uid={txtUser.Text};Pwd={txtPass.Text};";
public string ConnectionString => $"Server={txtHost.Text};Port={txtPort.Text};Database={ddlDatabases.Text};Uid={txtUser.Text};Pwd={txtPass.Text};AllowLoadLocalInfile=true;";
public bool ConnectionOnly { get; set; } = false;
public DBEntry Entry { get; set; }
public string ErrorMessage = string.Empty;
Expand Down Expand Up @@ -143,16 +144,19 @@ private void ddlDatabases_SelectedIndexChanged(object sender, EventArgs e)
using (MySqlConnection connection = new MySqlConnection(ConnectionString))
{
connection.Open();
MySqlCommand command = new MySqlCommand($"USE {ddlDatabases.Text}; SHOW TABLES;", connection);
using (var rdr = command.ExecuteReader())
//string sql = $"SELECT table_name FROM information_schema.tables WHERE table_schema = {ddlDatabases.Text}";
string sql = $"USE {ddlDatabases.Text}; SHOW TABLES;";
MySqlCommand command = new MySqlCommand(sql, connection);
using (var reader = command.ExecuteReader())
{
ddlTable.Items.Add("");
while (rdr.Read())
ddlTable.Items.Add(rdr[0].ToString());
while (reader.Read())
{
ddlTable.Items.Add(reader.GetString(0));
}
}
}
}
catch { return; }
catch(Exception ex) { MessageBox.Show(ex.Message); return; }
}

btnLoad.Enabled = !string.IsNullOrWhiteSpace(ddlDatabases.Text) && //Database selected
Expand Down
15 changes: 9 additions & 6 deletions WDBXEditor/Forms/WotLKItemFix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Threading.Tasks;
using System.Windows.Forms;
using static WDBXEditor.Common.Constants;
using MySqlX.XDevAPI.Relational;

namespace WDBXEditor
{
Expand Down Expand Up @@ -109,15 +110,17 @@ private void ddlDatabases_SelectedIndexChanged(object sender, EventArgs e)
{
connection.Open();
MySqlCommand command = new MySqlCommand(sql, connection);
using (var rdr = command.ExecuteReader())
{
ddlTable.Items.Add("");
while (rdr.Read())
ddlTable.Items.Add(rdr[0].ToString());
using (MySqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
ddlTable.Items.Add(reader.GetString(0));
MessageBox.Show(reader.GetString(0));
}
}
}
}
catch { return; }
catch (Exception ex) { MessageBox.Show(ex.Message); }
}

btnLoad.Enabled = !string.IsNullOrWhiteSpace(ddlDatabases.Text) && //Database selected
Expand Down
28 changes: 18 additions & 10 deletions WDBXEditor/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -641,17 +641,25 @@ private void toSQLToolStripMenuItem_Click(object sender, EventArgs e)
{
if (sql.ShowDialog(this) == DialogResult.OK)
{
ProgressBarHandle(true, "Exporting to SQL...");
Task.Factory.StartNew(() => { LoadedEntry.ToSQLTable(sql.ConnectionString); })
.ContinueWith(x =>
try
{
if (x.IsFaulted)
MessageBox.Show("An error occured exporting to SQL.");
else
MessageBox.Show("Sucessfully exported to SQL.");

ProgressBarHandle(false);
}, TaskScheduler.FromCurrentSynchronizationContext());
ProgressBarHandle(true, "Exporting to SQL...");
Task.Factory.StartNew(() => { LoadedEntry.ToSQLTable(sql.ConnectionString); })
.ContinueWith(x =>
{
if (x.IsFaulted)
MessageBox.Show("An error occured exporting to SQL. ");
else
MessageBox.Show("Sucessfully exported to SQL.");

ProgressBarHandle(false);
}, TaskScheduler.FromCurrentSynchronizationContext());
}
catch (Exception ex)
{
MessageBox.Show("An error occured exporting to SQL. " + ex.Message);
}

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion WDBXEditor/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion WDBXEditor/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion WDBXEditor/Reader/ColumnStructureEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ColumnStructureEntry
public ushort RecordOffset { get; set; }
public ushort Size { get; set; }
public uint AdditionalDataSize { get; set; }
public CompressionType CompressionType { get; set; }
public CompressionTypeWDBX CompressionTypeWDBX { get; set; }
public int BitOffset { get; set; } // used as common data column for Sparse
public int BitWidth { get; set; }
public int Cardinality { get; set; } // flags for Immediate, &1: Signed
Expand Down
Loading