Skip to content

Commit

Permalink
Upgrade & restructure projects
Browse files Browse the repository at this point in the history
- Upgrade to .NET Framework 4.8 for VS 2022
- Add unit test project
- Most of the application moved to Shared library
  • Loading branch information
NotCoffee418 committed Nov 3, 2021
1 parent 86a336e commit d4cd876
Show file tree
Hide file tree
Showing 156 changed files with 1,217 additions and 834 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Text;
using System.Threading.Tasks;

namespace TrinityCreator.DBC
namespace TrinityCreator.Shared.DBC
{
class DBCQuery
{
Expand Down Expand Up @@ -61,19 +61,19 @@ public static DataTable GetQuestSortNames()
new string[] { "id", "name" });
}

internal static DataTable GetSpells()
public static DataTable GetSpells()
{
return DbcHandler.LoadDbc("Spell",
new string[] { "m_ID", "m_name_lang_1", "m_description_lang_1" });
}

internal static DataTable GetMap()
public static DataTable GetMap()
{
return DbcHandler.LoadDbc("Map",
new string[] { "m_ID", "m_MapName_lang1" });
}

internal static DataTable GetFaction()
public static DataTable GetFaction()
{
// basic factions
var result = DbcHandler.LoadDbc("Faction", new string[] { "m_ID", "m_name_lang_1" });
Expand All @@ -84,14 +84,14 @@ internal static DataTable GetFaction()
return result;
}

internal static DataTable GetCharTitles()
public static DataTable GetCharTitles()
{
return DbcHandler.LoadDbc("CharTitles",
new string[] { "field0", "field2" });
}


internal static DataTable GetEmotes()
public static DataTable GetEmotes()
{
return DbcHandler.LoadDbc("Emotes",
new string[] { "id", "description" });
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
using DBCViewer;
using System.Globalization;
using System.Xml;
using TrinityCreator.UI;
using TrinityCreator.Helpers;
using TrinityCreator.Shared.Helpers;
using TrinityCreator.Shared.UI;

namespace TrinityCreator.DBC
namespace TrinityCreator.Shared.DBC
{
class DbcHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
class CExceptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TrinityCreator.Database;
using TrinityCreator.Shared.Database;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class Coordinate
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class CreatureFamily : IKeyValue
{
Expand All @@ -10,7 +10,7 @@ public CreatureFamily(int id, string description, int petSpellDataId = 0)
Description = description;
PetSpellDataId = petSpellDataId;
}
public int PetSpellDataId { get; internal set; }
public int PetSpellDataId { get; set; }
public override string ToString()
{
return Description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Windows;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class Currency : INotifyPropertyChanged
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class Damage : INotifyPropertyChanged
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class DamageType : IKeyValue
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public abstract class IKeyValue
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class ItemClass : IKeyValue
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class ItemInventoryType : IKeyValue
{
Expand All @@ -11,7 +11,7 @@ public ItemInventoryType(int id, string description, int sheath = 0)

public int Sheath { get; set; }

internal static ItemInventoryType[] GetAllInventoryTypes()
public static ItemInventoryType[] GetAllInventoryTypes()
{
var result = new List<ItemInventoryType>();
result.AddRange(GetNonEquipable());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class ItemMaterial : IKeyValue
{
public ItemMaterial(int id, string description)
: base(id, description) { }

internal static ItemMaterial GetConsumable()
public static ItemMaterial GetConsumable()
{
return new ItemMaterial(-1, "Consumable");
}

internal static ItemMaterial GetUndefined()
public static ItemMaterial GetUndefined()
{
return new ItemMaterial(1, "Not Defined");
}

internal static ItemMaterial GetPlate()
public static ItemMaterial GetPlate()
{
return new ItemMaterial(6, "Plate");
}

internal static ItemMaterial GetChain()
public static ItemMaterial GetChain()
{
return new ItemMaterial(5, "Chainmail");
}

internal static ItemMaterial GetLeather()
public static ItemMaterial GetLeather()
{
return new ItemMaterial(8, "Leather");
}

internal static ItemMaterial GetCloth()
public static ItemMaterial GetCloth()
{
return new ItemMaterial(7, "Cloth");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Linq;
using System.Windows.Media;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class ItemQuality : IKeyValue, INotifyPropertyChanged
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class ItemSubClass : IKeyValue, INotifyPropertyChanged
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Windows.Media.Imaging;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class Socket : IKeyValue
{
Expand All @@ -24,16 +24,16 @@ public static Socket[] GetSocketList()
return new[]
{
new Socket(1, "Meta",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator;component/Resources/metasocket.png",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator.Shared;component/Resources/metasocket.png",
UriKind.Absolute))),
new Socket(2, "Red",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator;component/Resources/redsocket.png",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator.Shared;component/Resources/redsocket.png",
UriKind.Absolute))),
new Socket(4, "Yellow",
new BitmapImage(new Uri(
"pack://application:,,,/TrinityCreator;component/Resources/yellowsocket.png", UriKind.Absolute))),
"pack://application:,,,/TrinityCreator.Shared;component/Resources/yellowsocket.png", UriKind.Absolute))),
new Socket(8, "Blue",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator;component/Resources/bluesocket.png",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator.Shared;component/Resources/bluesocket.png",
UriKind.Absolute)))
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class TrainerData : IKeyValue
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
using System;
using MySql.Data.MySqlClient;
using System;
using System.Data;
using System.Windows;
using MySql.Data.MySqlClient;
using TrinityCreator.Properties;
using System.Windows.Threading;
using System.Threading;
using TrinityCreator.UI;
using TrinityCreator.Helpers;
using TrinityCreator.Data;
using System.Text.RegularExpressions;
using System.Windows;
using TrinityCreator.Shared.Data;
using TrinityCreator.Shared.Helpers;
using TrinityCreator.Shared.UI;

namespace TrinityCreator.Database
namespace TrinityCreator.Shared.Database
{
internal class Connection
public class Connection
{
private static MySqlConnection _conn;

Expand All @@ -24,11 +21,11 @@ internal class Connection
/// <param name="pass"></param>
/// <param name="dbName"></param>
/// <returns>null on success or exception</returns>
internal static Exception Test(string connString = "")
public static Exception Test(string connString = "")
{
if (connString == "")
connString = Settings.Default.worldDb;
else if (connString == Settings.Default.worldDb && Open())
connString = Properties.Settings.Default.worldDb;
else if (connString == Properties.Settings.Default.worldDb && Open())
return null;

try
Expand All @@ -52,7 +49,7 @@ internal static Exception Test(string connString = "")
/// </summary>
/// <param name="requestConfig">Asked to enter configuration?</param>
/// <returns></returns>
internal static bool Open(bool requestConfig = true)
public static bool Open(bool requestConfig = true)
{
if (!IsConfigured())
{
Expand All @@ -69,7 +66,7 @@ internal static bool Open(bool requestConfig = true)
else
{
Logger.Log("MySQL: Attemption to open MySQL connection...");
_conn = new MySqlConnection(Settings.Default.worldDb.ToString() +"charset=utf8;");
_conn = new MySqlConnection(Properties.Settings.Default.worldDb.ToString() +"charset=utf8;");
_conn.Open();
Logger.Log("MySQL: Successfully connected.");
return true;
Expand All @@ -94,7 +91,7 @@ internal static bool Open(bool requestConfig = true)
}
}

internal static void Close()
public static void Close()
{
if (_conn == null)
return;
Expand All @@ -104,7 +101,7 @@ internal static void Close()
_conn = null;
}

internal static void RequestConfiguration()
public static void RequestConfiguration()
{
var r =
MessageBox.Show(
Expand All @@ -120,9 +117,9 @@ internal static void RequestConfiguration()
/// Does not confirm if settings are valid right now
/// </summary>
/// <returns></returns>
internal static bool IsConfigured()
public static bool IsConfigured()
{
if (Settings.Default.worldDb == "")
if (Properties.Settings.Default.worldDb == "")
{
Logger.Log("MySQL: Connection has not been configured yet.");
return false;
Expand All @@ -134,7 +131,7 @@ internal static bool IsConfigured()
}
}

internal static (DataTable, bool) ExecuteQuery(string query, bool requestConfig = true)
public static (DataTable, bool) ExecuteQuery(string query, bool requestConfig = true)
{
Open(requestConfig);
try
Expand Down Expand Up @@ -162,7 +159,7 @@ internal static (DataTable, bool) ExecuteQuery(string query, bool requestConfig
}
}

internal static (object, bool) ExecuteScalar(string query, bool requestConfig = true)
public static (object, bool) ExecuteScalar(string query, bool requestConfig = true)
{
Open(requestConfig);
try
Expand All @@ -186,7 +183,7 @@ internal static (object, bool) ExecuteScalar(string query, bool requestConfig =
}
}

internal static bool ExecuteNonQuery(string query, bool requestConfig = true)
public static bool ExecuteNonQuery(string query, bool requestConfig = true)
{
Open(requestConfig);
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace TrinityCreator.Database
namespace TrinityCreator.Shared.Database
{
class DataType
{
Expand Down
Loading

0 comments on commit d4cd876

Please sign in to comment.