peterhaneve / evemon

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

Please update the database #294

Open wvdvegt opened 3 years ago

wvdvegt commented 3 years ago

Hi

The database is a few patches behind now (neurolink & nullifier bpo's are missing for example).

There seem to be no issues during the xml generation this time.

In my copy I automated download of the latest sql-lite bz2'ed db if missing.

    internal static class Program
    {
        const String db = "sqlite-latest.sqlite";

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        /// <returns></returns>
        [STAThread]
        private static void Main()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            // Setting a standard format for the generated files
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

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

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

            string decompressedFileName = Path.Combine(basepath, db);

            if (!File.Exists(decompressedFileName))
            {
                Console.WriteLine($"Downloading '{db}.bz2' from 'www.fuzzwork.co.uk/dump/{db}.bz2");

                using (WebClient client = new WebClient())
                {
                    //! veg: Without headers the download fails.
                    client.Headers.Add("Accept-Encoding", "bz2");
                    client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36 Edg/91.0.864.48");
                    client.Headers.Add("Referrer", "https://www.fuzzwork.co.uk/dump/");

                    client.DownloadFile($"https://www.fuzzwork.co.uk/dump/{db}.bz2", Path.Combine(basepath, $"{db}.bz2"));
                }

                Console.WriteLine($"Decompressing '{db}.bz2' into '{db}'");

                //! Decompress dump.
                FileInfo zipFileName = new FileInfo(Path.Combine(basepath, $"{db}.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);
                        }
                    }
                }
            }
gokeefe commented 2 years ago

Do you have a fork or patch with this change? I'm not sure where exactly to put this code

wvdvegt commented 2 years ago

Sorry forgot to mention, it replaces the program.cs from the XmlGenerator project within the evemon solution. Please note that you need to delete the sqlite-latest.* files in the project folder to trigger a download of a fresh one.

You also might want to disable the update checks as the checksum checks evemon does at startup fails and triggers an update data dialog. I'll have to check where that code resides (post it in a minute).

wvdvegt commented 2 years ago

Look in \src\EVEMon\MainWindow.cs for the method OnDataUpdateAvailable() and comment the (first) line :

if (m_isShowingDataUpdateWindow)

This will effectively disable the data update checks untill Peter Han resumes maintenance.

wvdvegt commented 2 years ago

Just updated myself and can confirm the new Rogue Drone Specialization skills show up nicely.

gokeefe commented 2 years ago

Just tried it and I also had to add a few lines to the top of Program.cs:

diff --git a/tools/XmlGenerator/Program.cs b/tools/XmlGenerator/Program.cs
index afd19abf..5ec720d3 100644
--- a/tools/XmlGenerator/Program.cs
+++ b/tools/XmlGenerator/Program.cs
@@ -1,16 +1,21 @@
 using System;
 using System.Diagnostics;
 using System.Globalization;
+using System.IO;
+using System.Net;
 using System.Threading;
 using EVEMon.XmlGenerator.Datafiles;
 using EVEMon.XmlGenerator.Providers;
 using EVEMon.XmlGenerator.Utils;
 using EVEMon.XmlGenerator.Xmlfiles;
+using ICSharpCode.SharpZipLib.BZip2;

Thanks!

wvdvegt commented 2 years ago

I noticed I posted a code fragment when i started this issue.

So you're absolutly right about the missing using statements.

For a reference, here's the complete program.cs source file:

using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Net;
using System.Threading;
using EVEMon.XmlGenerator.Datafiles;
using EVEMon.XmlGenerator.Providers;
using EVEMon.XmlGenerator.Utils;
using EVEMon.XmlGenerator.Xmlfiles;
using ICSharpCode.SharpZipLib.BZip2;

namespace EVEMon.XmlGenerator
{
    internal static class Program
    {
        const String db = "sqlite-latest.sqlite";

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        /// <returns></returns>
        [STAThread]
        private static void Main()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            // Setting a standard format for the generated files
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

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

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

            string decompressedFileName = Path.Combine(basepath, db);

            if (!File.Exists(decompressedFileName))
            {
                Console.WriteLine($"Downloading '{db}.bz2' from 'www.fuzzwork.co.uk/dump/{db}.bz2");

                using (WebClient client = new WebClient())
                {
                    //! veg: Without headers the download fails.
                    client.Headers.Add("Accept-Encoding", "bz2");
                    client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36 Edg/91.0.864.48");
                    client.Headers.Add("Referrer", "https://www.fuzzwork.co.uk/dump/");

                    client.DownloadFile($"https://www.fuzzwork.co.uk/dump/{db}.bz2", Path.Combine(basepath, $"{db}.bz2"));
                }

                Console.WriteLine($"Decompressing '{db}.bz2' into '{db}'");

                //! Decompress dump.
                FileInfo zipFileName = new FileInfo(Path.Combine(basepath, $"{db}.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();

            Console.WriteLine();

            // Generate datafiles
            Properties.GenerateDatafile();
            Skills.GenerateDatafile();

            //Masteries.GenerateDatafile();

            Geography.GenerateDatafile();
            Blueprints.GenerateDatafile();
            Items.GenerateDatafile(); // Requires GenerateProperties()
            Reprocessing.GenerateDatafile(); // Requires GenerateItems()

            // Generate MD5 Sums file
            Util.CreateMD5SumsFile("MD5Sums.txt");

            // Generate support xml files
            Flags.GenerateXmlfile();

            Console.WriteLine(@"Generating files completed in {0:g}", stopwatch.Elapsed);
            Console.WriteLine();
            Console.Write(@"Press any key to exit.");
            Console.ReadKey(true);
        }
    }
}
ajaxify commented 2 years ago

Sorry to bother, but I'm not a C# developer (or at least, I haven't been touched it in like 10 years) and I'm having some trouble getting the XML Generator to run with your new Program.cs.

After installing the package through nuget in Visual Studio, I try to run the XML Generator and see the following error:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=1.3.3.11, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.
   at EVEMon.XmlGenerator.Program.Main()

Any idea what I'm missing here? Before I installed through nuget, I was getting this error in the IDE, but now I'm getting it at runtime instead. I'm guessing it's not linking properly, but I'm not sure what to really be googling for. Thanks for any help you can give.

wvdvegt commented 2 years ago

Hi,

Evemon is build using nuGet packages (nuget.org). It seems the zlib package is missing (and hence the SharpZipLib dll/assembly).

Normally visual studio notices and tells you to retore the nuget packages (if you right click the project and chose the nuget menu option it should be in the nuget package manager somewher too, else you have to restore using the Nuget CLI interface).

See https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore