Search for Content in Files triggers OnChange Event in apps

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Post Reply
Acecool
Posts: 43
Joined: 25 May 2016 11:13

Search for Content in Files triggers OnChange Event in apps

Post 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!

admin
Site Admin
Posts: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

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

Post 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.

Acecool
Posts: 43
Joined: 25 May 2016 11:13

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

Post by Acecool »

.Lua files ( text files ) - Here's how Garry set the system up for monitoring: https://garry.tv/2012/08/10/auto-refresh/

admin
Site Admin
Posts: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

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

Post by admin »

So, is it fixed in v16.80.0008?

Acecool
Posts: 43
Joined: 25 May 2016 11:13

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

Post 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...
Last edited by Acecool on 29 May 2016 00:59, edited 1 time in total.

highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

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

Post by highend »

One of my scripts helped you out? Please donate via Paypal

Acecool
Posts: 43
Joined: 25 May 2016 11:13

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

Post 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!

admin
Site Admin
Posts: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

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

Post by admin »

Hmm, I cannot see what else could trigger this. Mystery.

Acecool
Posts: 43
Joined: 25 May 2016 11:13

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

Post 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..

admin
Site Admin
Posts: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

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

Post 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.

Acecool
Posts: 43
Joined: 25 May 2016 11:13

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

Post 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.

Post Reply