peterhaneve / evemon

A lightweight, easy-to-use standalone Windows application designed to assist you in keeping track of your EVE Online character progression.
311 stars 70 forks source link

XmlGenerator #275

Closed wvdvegt closed 3 years ago

wvdvegt commented 3 years ago

Hi

Tried to run the XmlGenerator to generate new data files (including the new Fleet skills) and came across a small issue

In Items.cs/CreateItem i changed line 226 into

Category = Database.InvCategoriesTable.HasValue(itemGroup.CategoryID) ? Database.InvCategoriesTable[itemGroup.CategoryID].Name : "Error",

to prevent an error on a missing category for some exotic item.

wvdvegt commented 3 years ago

I also added code to download & decompress the dump from https://www.fuzzwork.co.uk/dump/latest/ when missing.

In program.cs I added:

            //! Download sqlite-latest.sqlite.bz2
            //! https://www.fuzzwork.co.uk/dump/sqlite-latest.sqlite.bz2

            string basepath = Path.GetFullPath(@".\..\..");

            string decompressedFileName = Path.Combine(basepath, "sqlite-latest.sqlite");

            if (!File.Exists(decompressedFileName))
            {
                Console.WriteLine("Downloading 'sqlite-latest.sqlite.bz2' from 'www.fuzzwork.co.uk/dump,");

                using (WebClient client = new WebClient())
                {
                    client.DownloadFile("https://www.fuzzwork.co.uk/dump/sqlite-latest.sqlite.bz2", Path.Combine(basepath, "sqlite-latest.sqlite.bz2"));
                }

                Console.WriteLine("Decompressing 'sqlite-latest.sqlite.bz2' into 'sqlite-latest.sqlite'");

                //! Decompress dump.
                FileInfo zipFileName = new FileInfo(Path.Combine(basepath, "sqlite-latest.sqlite.bz2"));
                using (FileStream fileToDecompressAsStream = zipFileName.OpenRead())
                {
                    using (FileStream decompressedStream = File.Create(decompressedFileName))
                    {
                        try
                        {
                            BZip2.Decompress(fileToDecompressAsStream, decompressedStream, true);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                    }
                }
            }

            // Create tables from database
            Database.CreateTables();

I had to add the sharpzlib v1.2 package and remove the line

del "$(TargetDir)"*SharpZipLib*

from the XmlGenerator.xsproj file's PostBuildEvent section.

peterhaneve commented 3 years ago

The missing category is due to CCP forgetting to add categories to the SDE for new items that were only meant for QA/testing, as the SDE and ESI are essentially no longer maintained.