more work on commands

- moved script object to wrapper class to catch and log exceptions
- added loggers for basepacket/subpacket (todo: colour and use them in NLog.config)
- finished up most commands (todo: !property and !property2)
- todo: create and use mysql wrapper class to log exceptions
This commit is contained in:
Tahir Akhlaq 2016-06-17 05:05:31 +01:00
parent 57b9d5ab99
commit 1ad2b5d7d0
35 changed files with 780 additions and 958 deletions

View file

@ -35,6 +35,14 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.3.5\lib\net45\NLog.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@ -49,10 +57,12 @@
<Compile Include="Blowfish.cs" />
<Compile Include="EfficientHashTables.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sql.cs" />
<Compile Include="STA_INIFile.cs" />
<Compile Include="Utils.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View file

@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
using NLog;
namespace FFXIVClassic.Common
{
/*
class SqlCommand
{
public static Logger Log = LogManager.GetCurrentClassLogger();
public SqlCommand()
{
}
public SqlCommand(string cmdText)
{
try
{
MySqlCommand.MySqlCommand("");
}
}
public SqlCommand(string cmdText, MySqlConnection connection);
public SqlCommand(string cmdText, MySqlConnection connection, MySqlTransaction transaction);
~SqlCommand()
{
}
public int CacheAge { get; set; }
public string CommandText { get; set; }
public int CommandTimeout { get; set; }
public CommandType CommandType { get; set; }
public MySqlConnection Connection { get; set; }
public bool DesignTimeVisible { get; set; }
public bool EnableCaching { get; set; }
public bool IsPrepared { get; }
public long LastInsertedId { get; }
public MySqlParameterCollection Parameters { get; }
public MySqlTransaction Transaction { get; set; }
public UpdateRowSource UpdatedRowSource { get; set; }
protected DbConnection DbConnection { get; set; }
protected DbParameterCollection DbParameterCollection { get; }
protected DbTransaction DbTransaction { get; set; }
public IAsyncResult BeginExecuteNonQuery();
public IAsyncResult BeginExecuteNonQuery(AsyncCallback callback, object stateObject);
public IAsyncResult BeginExecuteReader();
public IAsyncResult BeginExecuteReader(CommandBehavior behavior);
public void Cancel();
public SqlCommand Clone();
public MySqlParameter CreateParameter();
public void Dispose();
public int EndExecuteNonQuery(IAsyncResult asyncResult);
public MySqlDataReader EndExecuteReader(IAsyncResult result);
public int ExecuteNonQuery();
public MySqlDataReader ExecuteReader();
public MySqlDataReader ExecuteReader(CommandBehavior behavior);
public object ExecuteScalar();
public void Prepare();
protected DbParameter CreateDbParameter();
protected void Dispose(bool disposing);
protected DbDataReader ExecuteDbDataReader(CommandBehavior behavior);
}
*/
}

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<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.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
</configuration>

View file

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.3.5" tarGetFramework="net45" />
<package id="MySql.Data" version="6.9.8" targetFramework="net45" />
<package id="NLog" version="4.3.5" tarGetFramework="net45" targetFramework="net45" />
</packages>