Jump to content

KSP Part Finder Application


Jiraiyah

Recommended Posts

Latest Version : 1.4

Did you ever had to find a single part after adding tons of mods to either tweak it's configs or even delete it when you decided you won't need that part in game? Did you even noticed how badly config files for stock parts are named and organized under Squad folder?

Many of us had the tendency to add mods one after another and then play the game thinking that we could delete the parts that we won't need later on, and... we never were able to find that part between 20-50 folders sitting inside our GameData folder ! Not only we wouldn't know the name of the config file, but sometimes we couldn't even remember what mod was adding this specific part.

A night before I develop this little application, I was trying to find a stupid stock solar panel and even after 10 minutes of looking for it, I couldn't find it. You would think that Squad developers would name config files for parts properly related to the part title in game,..., you are dead wrong !

That is when I decided to write this little application, the development took less than 10 minutes and until now it saved more than few hours for me trying to look for a part.

What it does is really simple, you just set the GameData folder for it, then a text that you want to look for in the config file, being it the title for a part, it's manufacturer or part of it's description. When you hit search button, it will look into every config file sitting in GameData folder and it's sub folders, reading them and compare it's content with the text you gave the program, if it finds the text (ignoring the casing for easier typing time), it will add that config file to a list. At the end of lookup process, if the number of files are more than 4, it will warn you to reduce the count by adding more text to look for and won't do anything else. The reason for this is to stop users from doing a mistake and search for something that would cause hell for their pc. If the number of found files are 4 or less, then the program will open a browser window for each one of them separately and select the config file in it for you.

In my testing environment with tons of mods added, a search would take almost 3-6 seconds, and even when the tweak scale folder was one of the opening folders, I never had a situation that more than 4 folders would open up, specially if I would use the whole title for a part.

Have fun and enjoy this, thankfully, it is not KSP version related (unless they change the file extension for the config files, AKA, never :D)

Source license : MIT (Have fun)

Version History (Spoiler)

Spoiler

Version History :

1.4 : 1 - Fixed a crash when you manually add the GameData folder address and it does not exists

        2 - now you can search with multiple keywords using space or comma, for example "Copula ~a-1~" now can be searched with "Copula a 1" or "Copula a-1" or "Copula,a,1" or "Copula,a-1" or any other combination of space and comma to separate the key words

1.3 : Made progressbar function correctly, removed unneeded timer from the form

1.2 : Fixed missing json dll that would stop the application to show up (now injected into the exe assembly, so still one file for you :D). Moved searching to a separate thread so that the application wouldn't freeze during the search. Added progress bar to show the searching (not sure how useful it would be)

1.0 : Added Settings file to keep track of input fields between sessions. Added Ignore special folder ability to ignore tweak scale, Mech Jeb, and Filter Extension folders if needed.

4
 

DOWNLOAD (Space Dock)

SOURCE

Edited by Jiraiyah
Link to comment
Share on other sites

Thanks guys, Added the source to github, MIT, also SPECIAL THANKS TO SPACE DOCK for allowing my little application up in their website.

NEW : Version 1.0 is updated. look into version history in OP for more info. Keep in mind where ever you put the exe file, now you will have a settings.cfg file that is being used to track your inputs between sessions (better to put the exe file in a sub folder).

 

Edited by Jiraiyah
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
5 hours ago, TheRagingIrishman said:

Mac and Linux users can use it?

If you want to search for strings in .cfg files and print path, why not just use grep?

grep -R --include='*.cfg' -E 'title.*advanced.*reaction.*large' GameData
GameData/Squad/Parts/Command/advancedSasModuleLarge/advSasModuleLarge.cfg:      title = Advanced Reaction Wheel Module, Large


It's a pretty trivial to open matches in $EDITOR too. If you're running KDE on GNU/Linux, adding this:

function partsearch() { grep -R --include='*.cfg' -E "${1}" -l "${2}" | xargs kate; }

To e.g. your ~/.bash_aliases will give you a handy new command that opens all matches in editor tabs.
 

On 3/10/2016 at 1:15 PM, Jiraiyah said:

a search would take almost 3-6 seconds

Really? With 65 mods, the grep command takes 0.063s to execute. I've got KSP on an SSD, but even so...

Edited by steve_v
Example added
Link to comment
Share on other sites

8 hours ago, TheRagingIrishman said:

Looks like exactly what I've been looking for. One problem, I'm stuck on MacOS for the foreseeable future. Do you think you could make this Mono compatible so us Mac and Linux users can use it?

right now I don't have free time to work but I was planning on converting this into an internal plugin for KSP, at least that was the original though, when I get time, I need to first learn the API provided from ksp for app launcher buttons, then I would be good to go to convert this into an internal plugin

3 hours ago, steve_v said:

Really? With 65 mods, the grep command takes 0.063s to execute. I've got KSP on an SSD, but even so...

The reason it takes few seconds is that the application is been written for windows and there is no functionality (as much as I know) for looking into text provided by the operating system itself (like the one you mentions for linux based OS) so, I have to look into text myself and one after another check every single config file provided and then open the folders, the process of looking config after config, reading their content, check to see if it has all the key words provided, that takes some milliseconds to do, thankfully in the last version I pulled the whole process into a thread so the main thread is free and the interface is not locking up.

One more thing to mention is that, if you want this to simply remove some parts from the game, you should use janitor closet, the mod lets you hide the parts and permanently prune them if you want, withing the game, you can export the list and import it for another version of game too.

This program is aimed more for people who want to take a look into a config file of a single part, either to get the part name for a module manager patch or, to copy some modules from it for any purpose they have in mind. at the time of recording my video, I was not familiar with the janitor closet mod myself.

Link to comment
Share on other sites

On 2016-12-21 at 2:42 PM, Jiraiyah said:

The reason it takes few seconds is that the application is been written for windows and there is no functionality (as much as I know) for looking into text provided by the operating system itself (like the one you mentions for linux based OS) so, I have to look into text myself and one after another check every single config file provided and then open the folders, the process of looking config after config, reading their content, check to see if it has all the key words provided, that takes some milliseconds to do, thankfully in the last version I pulled the whole process into a thread so the main thread is free and the interface is not locking up.

I think you might find this answer on Stackoverflow interesting, used some of it myself long ago when I needed to find certain strings in the CKAN metadata archives.

Link to comment
Share on other sites

4 minutes ago, Dazpoet said:

I think you might find this answer on Stackoverflow interesting, used some of it myself long ago when I needed to find certain strings in the CKAN metadata archives.

thanks, will look into it in a day or two when I have some free time for coding :D

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...