diff --git a/DBC2CSV.sln b/DBC2CSV.sln index 932f375..5161c33 100644 --- a/DBC2CSV.sln +++ b/DBC2CSV.sln @@ -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 @@ -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 diff --git a/DBC2CSV/DBC2CSV.csproj b/DBC2CSV/DBC2CSV.csproj index 98e1552..59220b1 100644 --- a/DBC2CSV/DBC2CSV.csproj +++ b/DBC2CSV/DBC2CSV.csproj @@ -4,11 +4,10 @@ Exe net8.0 - - + - + diff --git a/DBC2CSV/Program.cs b/DBC2CSV/Program.cs index 3905ee4..73b7f14 100644 --- a/DBC2CSV/Program.cs +++ b/DBC2CSV/Program.cs @@ -1,5 +1,5 @@ using DBCD; -using DBFileReaderLib; +using DBCD.IO; using System; using System.Collections.Generic; using System.IO; @@ -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; @@ -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(); var hotfixFiles = new List(); - - 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)) { @@ -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 hotfixReaders = new List(); - + if (hotfixFiles.Count > 0) { Console.WriteLine(".bin file(s) supplied, loading hotfixes.."); @@ -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); @@ -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!"); @@ -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); }