midora Posted September 5, 2021 Share Posted September 5, 2021 I would use the file extension .a.gif instead of .agif. The advantage would be that there would no longer be the need to change the extension to offer support for animated gif files. I tested the property in one of my applications and it works as expected to filter the list in the dialog. Supported in .net 5 and older versions. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted September 5, 2021 Share Posted September 5, 2021 Adding support for the file dialog is, as you point out, easy. However, all the other code for handling extensions, via things like Path.ChangeExtension() and Path.GetExtension(), don't -- AFAIK -- support this. So it would be quite a bit of work to implement and validate. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
midora Posted September 5, 2021 Author Share Posted September 5, 2021 I know there is more to do than just setting the flag to true. You are right there is no additional support. I used a list of extensions (starting with dots) sorted by length (long ones first) and used EndsWith to find the matching extension type. But it's more a suggestion for the future and not something we need just now. And maybe having in mind that this maybe helpful. I may also add load to ImPdf if I would know that .im.pdf is supported so that the plugin could expect that the pdf contains just images. As long as there is no open dialog which could be canceled you always have to throw an error if the file is valid but does not fulfill the requirements. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted September 5, 2021 Share Posted September 5, 2021 There's also the problem of determining that a file has multi-dotted extensions. For files that are handled by FileTypes (built-in or plugins), it's easy enough to determine if a file has that extension by using string.EndsWith(). But a file can have multiple dots for other reasons, like Some.Image.With.Multiple.Words.1.png. Especially if a file has an extension for a file type that isn't supported, like for a plugin that isn't installed. How do you detect multi-dotted extensions for types you don't know anything about? You can't remove them, so you could end up with somefile.im.im.im.pdf or whatever. I honestly don't see much use for this, I'm not convinced it's important or useful. This feature has to go way beyond "oh wouldn't that'd be neat" for it to get serious consideration. File extensions are, by convention, dotless. Anything beyond that is opening a Pandora's box full of bugs that doesn't seem worth my headache, nor the trouble for end-users. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
midora Posted September 5, 2021 Author Share Posted September 5, 2021 That's fine. EndsWith() is used just because of the issue you mentioned that the name contains dots (otherwise you would look for the first dot in the name). The file dialog seems to work similar. I never got a negative feedback from end-users (but typically they are engineers). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.