Skip to content

Commit

Permalink
Move to DBCD package
Browse files Browse the repository at this point in the history
  • Loading branch information
Marlamin committed Oct 1, 2024
1 parent dd85c5e commit ced0da6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 30 deletions.
18 changes: 3 additions & 15 deletions DBC2CSV.sln
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29418.71
# Visual Studio Version 17
VisualStudioVersion = 17.11.35312.102
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DBC2CSV", "DBC2CSV\DBC2CSV.csproj", "{216EF84C-0030-4AB4-AAC7-25F10ABB4650}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DBCD", "DBCD\DBCD\DBCD.csproj", "{B2C5B103-5396-44EF-A529-ED5D067BFAB8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DBFileReaderLib", "DBCD\DBFileReaderLib\DBFileReaderLib.csproj", "{A570F77E-9460-4243-93B3-755B7C0BB157}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DBC2CSV", "DBC2CSV\DBC2CSV.csproj", "{216EF84C-0030-4AB4-AAC7-25F10ABB4650}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -19,14 +15,6 @@ Global
{216EF84C-0030-4AB4-AAC7-25F10ABB4650}.Debug|Any CPU.Build.0 = Debug|Any CPU
{216EF84C-0030-4AB4-AAC7-25F10ABB4650}.Release|Any CPU.ActiveCfg = Release|Any CPU
{216EF84C-0030-4AB4-AAC7-25F10ABB4650}.Release|Any CPU.Build.0 = Release|Any CPU
{B2C5B103-5396-44EF-A529-ED5D067BFAB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2C5B103-5396-44EF-A529-ED5D067BFAB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2C5B103-5396-44EF-A529-ED5D067BFAB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2C5B103-5396-44EF-A529-ED5D067BFAB8}.Release|Any CPU.Build.0 = Release|Any CPU
{A570F77E-9460-4243-93B3-755B7C0BB157}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A570F77E-9460-4243-93B3-755B7C0BB157}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A570F77E-9460-4243-93B3-755B7C0BB157}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A570F77E-9460-4243-93B3-755B7C0BB157}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 2 additions & 3 deletions DBC2CSV/DBC2CSV.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\DBCD\DBCD\DBCD.csproj" />
<Content Include="..\WoWDBDefs\definitions\**" LinkBase="definitions\" CopyToOutputDirectory="Always" />
</ItemGroup>
<ItemGroup>
<Content Include="..\WoWDBDefs\definitions\**" LinkBase="definitions\" CopyToOutputDirectory="Always" />
<PackageReference Include="DBCD" Version="2.0.3" />
</ItemGroup>
</Project>
23 changes: 11 additions & 12 deletions DBC2CSV/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using DBCD;
using DBFileReaderLib;
using DBCD.IO;
using System;
using System.Collections.Generic;
using System.IO;
Expand All @@ -13,7 +13,7 @@ class Program
{
static void Main(string[] args)
{
if(args.Length == 0)
if (args.Length == 0)
{
Console.WriteLine("Expected argument: db2filename or db2folder");
return;
Expand All @@ -22,13 +22,12 @@ static void Main(string[] args)
// Force system culture to ensure that decimal separator is always a dot
Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;


var filesToExport = new List<string>();
var hotfixFiles = new List<string>();
foreach(var arg in args)

foreach (var arg in args)
{
if(arg.EndsWith(".db2") || arg.EndsWith(".dbc"))
if (arg.EndsWith(".db2") || arg.EndsWith(".dbc"))
{
if (!File.Exists(arg))
{
Expand Down Expand Up @@ -61,10 +60,10 @@ static void Main(string[] args)
var newLinesInStrings = true;

var dbdProvider = new DBDProvider();

// TODO: Somehow figure out how to filter on the right build for the supplied DB2s?
List<HotfixReader> hotfixReaders = new List<HotfixReader>();

if (hotfixFiles.Count > 0)
{
Console.WriteLine(".bin file(s) supplied, loading hotfixes..");
Expand All @@ -77,7 +76,7 @@ static void Main(string[] args)

Console.WriteLine("Loaded hotfixes for build " + hotfixReaders[0].BuildId);
}

foreach (var fileToExport in filesToExport)
{
var dbcd = new DBCD.DBCD(new DBCProvider(Path.GetDirectoryName(fileToExport)), dbdProvider);
Expand All @@ -91,9 +90,9 @@ static void Main(string[] args)

if (hotfixFiles.Count > 0)
{
storage = storage.ApplyingHotfixes(hotfixReaders[0]);
storage.ApplyingHotfixes(hotfixReaders[0]);
}

if (!storage.Values.Any())
{
throw new Exception("No rows found!");
Expand Down Expand Up @@ -177,7 +176,7 @@ static void Main(string[] args)
File.WriteAllBytes(Path.Combine(Path.GetDirectoryName(fileToExport), tableName + ".csv"), exportStream.ToArray());
}
}
catch(Exception e)
catch (Exception e)
{
Console.WriteLine("Failed to export DB2 " + tableName + ": " + e.Message);
}
Expand Down

0 comments on commit ced0da6

Please sign in to comment.