For a long time, I've been looking for a class in .NET that has functionality that makes it so that the operating system thinks there is a file (or directory, or both, etc) at a particular location - but all hooks are passed to a function (or event?) in code.
Example:
If I browse to "x:\fake_directory\" I will see a file there, "fake_file.txt". If I double click on the file, Notepad.exe will launch and the file contents would say "Hello World". "Hello World" would come from my c# code.
Example of what I hope the class can do (maybe this will explain it better):
VirtualFile.Register("c:\my_file.txt",
delegate { return Encoding.Ascii.GetBytes("Hello World"); });
That's, of course, a simplified version of what I'm looking for... but hopefully you get the idea.
The reason why this is 100% needed is to work with legacy code or proprietary (and very old legacy garbage) systems that require reading and writing to the file system to communicate.
VirtualFile
class will not work for the requirements in the question. This class is specifically designed to work with and only consumed by the ASP.NET compilation system. Standard IO libraries are not aware of this type and therefore will not be able to do anything with it. – Svetlana