Page 1 of 1

Search for Content in Files triggers OnChange Event in apps

Posted: 26 May 2016 00:48
by Acecool
I code in many languages, but because logic is universal I prefer to use Garry's Mod using a C style Lua / GLua... One thing about the game is that it auto-refreshed the scripts when a change has been applied to a file ( the file was saved )... I also wrote my own autoloader system which handles the load-order instead of hard-coding the include and AddCSLuaFile ( send salted-compressed file to client so they have it to include ) and I added other features so if 2 auto-refresh events are triggered at the same time ( or while another load is still under-way ), it'll only load the first time..

The issue is there are over 1000 files all organized in a neat folder-structure by extensions of existing code, extensions to existing meta-tables, libraries ( new meta-tables / class-like objects that can be closed which can have static vars, or public ), content, etc...

When using the search feature inside of XYplorer to search all files inside the folder, including subfolders etc..., for specific content.. XYplorer triggers an on-change event for each of the files, so I end up with the auto-refresh system thinking that 1000 files are being refreshed and with the loader it has to logically check whether or not to load those 1000 files 1000 times ( or it may be linked to the number of data it finds per file PLUS each file it searches because even if something is found in only 1 file several times it still triggers the on-change event for all of the files )...

The way I coded it, as explained above, is if a load is currently in progress then it'll simply skip trying to process any of the files for inclusion... But, the search takes time and including 1000 files also takes a few seconds so by it spamming the on-change events, XY is still forcing the system to include the files over the course of however long it takes to run the search meaning out of the 1000 files, while on change is triggered that many times the actual inclusion system may run 100 or more times because the on-change is triggered at different times ( the system is based on time so if all of the changes were triggered at once, which isn't feasible, it'd deny 999 of the 1000; but it isn't so as soon as a load cycle completes the next one starts )...

I haven't checked all of the available timestamps ( created, modified, accessed ) but the created and modified timestamps remained the same, ie unchanged... so something else is causing the on-change event to be triggered in other software and it would be great to have that resolved!

Re: Search for Content in Files triggers OnChange Event in a

Posted: 26 May 2016 08:21
by admin
I assume these are all text files? What is their extension(s)?

PS: Whatever, I had an idea and try a fix in next beta.

Re: Search for Content in Files triggers OnChange Event in a

Posted: 26 May 2016 09:16
by Acecool
.Lua files ( text files ) - Here's how Garry set the system up for monitoring: https://garry.tv/2012/08/10/auto-refresh/

Re: Search for Content in Files triggers OnChange Event in a

Posted: 26 May 2016 20:11
by admin
So, is it fixed in v16.80.0008?

Re: Search for Content in Files triggers OnChange Event in a

Posted: 29 May 2016 00:54
by Acecool
http://www.xyplorer.com/download.php Still only lists .0000 as the latest..

Edit: Beta? http://www.xyplorer.com/xyfc/viewtopic. ... =d#p139029 -- downloaded and testing...

Re: Search for Content in Files triggers OnChange Event in a

Posted: 29 May 2016 00:59
by highend

Re: Search for Content in Files triggers OnChange Event in a

Posted: 29 May 2016 01:14
by Acecool
Saw beta just prior to you posting...

I'm using the no-install method..

Unfortunately it is still triggering the auto-refresh based on the files it is searching... I'm not sure if it is triggering it as many times, more or less... I did notice that it triggered the weapons base 50 times this time; I do not believe it did this before but I could be wrong.

Either way it is still triggering the change.. Other find-contents-in-files programs such as this one I've used for a long time: https://dl.dropboxusercontent.com/u/260 ... rv1.4e.exe .. doesn't do this.. I don't use it frequently anymore because if you forget to checkmark Only Finding, then it'll replace... And you can't resize the window, if you try forcing it using other utilities then each component of the window stays the same size...

Thank you for adding the search buttons as an overlay to each of the sub-tabs under Find Files. It makes using it easier!

Re: Search for Content in Files triggers OnChange Event in a

Posted: 29 May 2016 11:58
by admin
Hmm, I cannot see what else could trigger this. Mystery.

Re: Search for Content in Files triggers OnChange Event in a

Posted: 29 May 2016 14:28
by Acecool
When you read the file, are you reading with write permissions ( or append / prepend flag )? Are you altering any flags at all, or data??

If you're simply reading the data using read-only flag to open, compare then close it shouldn't trigger... Even locking / unlocking the file shouldn't cause it to trigger I don't believe...


Notepad++ and the TextReplacer both only trigger the on-change event if something inside the file gets altered...


What language are you using to code XYplorer with? C++, C#, or another? I am quite familiar with a variety of languages.. I may look into methods that does trigger it vs not triggering it if you can provide some more information ( at least the language, and maybe the method of reading / streaming through the file ) to come up with something that doesn't trigger vs triggers..

Re: Search for Content in Files triggers OnChange Event in a

Posted: 29 May 2016 15:02
by admin
Acecool wrote:When you read the file, are you reading with write permissions ( or append / prepend flag )? Are you altering any flags at all, or data??
Of course not.

Could you try if you get the same effect when you search *.txt files?
And in Find Files / Contents / Type it should be "Text" only.

Re: Search for Content in Files triggers OnChange Event in a

Posted: 04 Jun 2016 15:18
by Acecool
Text files aren't monitored for the auto-refresh system.. I just upgraded to windows 10 so I'm still setting everything up but I'll give it a go.