Armory tool

throwaway
Lieutenant
Posts: 1244
Joined: Fri 27 Feb 2015 21:23
Contact:

Re: Armory tool

Postby throwaway » Sat 11 Feb 2017 20:21

Bougnas wrote:Same stuff but I have the right content for teh settings.

Same stuff meaning the tool can't start and you also have windows 10 with the latest .NET Framework?

User avatar
Bougnas
Major-General
Posts: 3634
Joined: Sat 26 Apr 2014 18:24
Contact:

Re: Armory tool

Postby Bougnas » Sat 11 Feb 2017 20:22

throwaway wrote:
Bougnas wrote:Same stuff but I have the right content for teh settings.

Same stuff meaning the tool can't start and you also have windows 10 with the latest .NET Framework?


Nah, I have win 7. But it doesn't start either.
Image

User avatar
D-M
Posts: 8671
Joined: Sat 23 Jul 2011 11:10
Contact:

Re: Armory tool

Postby D-M » Sat 11 Feb 2017 22:07

Maybe you should add some error managing code. It's hard to debug stuffs without the user knowing what's going on a bit.
Image

urogard
Colonel
Posts: 2878
Joined: Sun 4 May 2014 13:31
Contact:

Re: Armory tool

Postby urogard » Sun 12 Feb 2017 00:06

Bougnas wrote:
throwaway wrote:
Bougnas wrote:Same stuff but I have the right content for teh settings.

Same stuff meaning the tool can't start and you also have windows 10 with the latest .NET Framework?


Nah, I have win 7. But it doesn't start either.

is wargame running?
as a rule, wargame tools won't be able access the game files if the game is running

throwaway
Lieutenant
Posts: 1244
Joined: Fri 27 Feb 2015 21:23
Contact:

Re: Armory tool

Postby throwaway » Sun 12 Feb 2017 01:02

urogard wrote: as a rule, wargame tools won't be able access the game files if the game is running

Just wrote a quick update to warn about that one at least :oops:

D-M wrote:Maybe you should add some error managing code. It's hard to debug stuffs without the user knowing what's going on a bit.

Unfortunately :| I cringe at the thought of wrapping all those file reads :cry:

Did you notice the issue I opened on github btw? I don't expect you to fix it, but after posting it I realized that I'm not sure if you login there at all.

User avatar
D-M
Posts: 8671
Joined: Sat 23 Jul 2011 11:10
Contact:

Re: Armory tool

Postby D-M » Sun 12 Feb 2017 02:50

I usually don't, I simply receive them on my email, and it was mixed with those from all the github project I follow.

And, well concerning Eugfloat2 and Eugint2, I don't remember why I didn't put them. Probably because I couldn't find a test bed in the AoA data set ?

I can look into it tomorrow, I beat right now.

Oh and you don't need to use try catch statement to do error management, you can do stuff like

Code: Select all

if(file.Read(data)==0)
   throw new Exception("didn't read shit");
   
or
if(!File.Exists(FILE_PATH))
   throw new Exception("No file :<");


And you don't really need to try catch functions that already throw exceptions (unlike in Java where you've to catch them at some point) unless you wan to modify what they throw or if they throw anything at all (they usually dump the whole call stack, can be hard to read), in production the exception will be displayed in a window.
Then again the whole call stack can contains all the needed information for the dev, it doesn't have to look nice to users.

And I think (didn't try but it looks strange to me) the issue is in your Program.cs file, line 35 to 45 :

Code: Select all

try {
                dataManager.ParseEdataFile();
            }
            catch (System.IO.IOException) {
                warning("IOException thrown, could not parse " + paths.getNdfPath()
                    + ".\nIf wargame is running, you'll have to close it to use the tool. You can avoid this by copying the files listed in settings.ini and then editing settings.ini to point to the copies.");
                Application.Exit();
                Environment.Exit(0);
            }


I wonder if your application actually take the time to display the warning window and wait for user input before terminating the application.


On a side note, I recomand you to use the lambda operator (the "=>") when you use LINQ methods, it just make the whole thing much cleaner to read and quicker to type, delegate are a real play to wrote when you are unsure how they work). For instance,

Code: Select all

List<String> filteredUnits = currentUnits.FindAll(delegate (string s) {
                try {
                    return Regex.IsMatch(s, textBox1.Text, RegexOptions.IgnoreCase);
                }
                catch (System.ArgumentException) {
                   return Regex.IsMatch(s, Regex.Escape(textBox1.Text), RegexOptions.IgnoreCase);
                }
            });

becomes

Code: Select all

List<String> filteredUnits = currentUnits.FindAll( x => textBox1.Text.Contains(x, StringComparison.OrdinalIgnoreCase));

And Regex sucks dicks, don't use Regex unless someone forces you at gunpoint. :<
For string operations, String, StringBuilder, and +- operator are usually enough for most purposes.
Image

throwaway
Lieutenant
Posts: 1244
Joined: Fri 27 Feb 2015 21:23
Contact:

Re: Armory tool

Postby throwaway » Sun 12 Feb 2017 03:10

D-M wrote:And I think (didn't try but it looks strange to me) the issue is in your Program.cs file, line 35 to 45 :

Code: Select all

...


I wonder if your application actually take the time to display the warning window and wait for user input before terminating the application.


I added that check today, so it's not the cause for Bougnas and Meph's problems [well, it may be that they crashed here before without an error message, now they'll get one if that's the case].

Thanks for the tips. Don't be such a regex extremist :roll:

User avatar
D-M
Posts: 8671
Joined: Sat 23 Jul 2011 11:10
Contact:

Re: Armory tool

Postby D-M » Sun 12 Feb 2017 03:55

Regex = SS
Image

throwaway
Lieutenant
Posts: 1244
Joined: Fri 27 Feb 2015 21:23
Contact:

Re: Armory tool

Postby throwaway » Mon 13 Feb 2017 18:39

New version, mainly a bugfix: https://mega.nz/#!DBMkgQRY!f7MUiT26RaL2 ... jWfoXNVXlc

Mephistopheles wrote:I am using Glorious Windows 10 but i cant get your Tool to work;

Bougnas wrote:Nah, I have win 7. But it doesn't start either.


Pretty sure this one should work for you. Nande found an embarassing oversight on my part which was causing crashes for new users, but it's fixed now :oops:

throwaway
Lieutenant
Posts: 1244
Joined: Fri 27 Feb 2015 21:23
Contact:

Re: Armory tool

Postby throwaway » Thu 16 Feb 2017 20:56

New version: https://mega.nz/#!bYczWQRa!qg71mF_AtLTq ... deyAMLCAbE (16-02-2017)

Lots of changes:
Added country flags
Added filtering by deck section
Reordered the interface, fixed some bad resize behavior
Added an icon

Who is online

Users browsing this forum: Bing [Bot] and 35 guests