I have an application that works with Visio drawing control and it needs to use a file with shapes for Visio drawing. I want to embed that file (stencil.vss) into my application so that I don't have to provide my stencil file when distributing application. I don't know how to access that file in code. My function needs file path to load that .vss file, so really what I don't know is, when that file is compiled along with application, how can I get it's path, because I need to provide a string as function parameter.
To the best of my recollection, you do need to provide a file system path to the Visio API in order to open a *.vss stencil file.
How are you embedding it in your application? Perhaps you could read it from its embedded location, and write it out to a user app data location, and then reference it after it's written out to disk on a per-user basis.
Related
There is a feature in OneDrive that you can see a file that is on the OneDrive site on your system without actually having that file in your system. And when you double click on that file, that file starts to download and you can see its contents.
I want to implement such a possibility with C#.
I have a site where files are uploaded.
I download the files from there and put them in a folder on my C drive.
But I want that file not to be downloaded until it is double-clicked, something similar to OneDrive.
What should I do?
I compared the FileInfo of these two files, but I didn't see any difference and I couldn't find a solution for this problem.
This is a virtual filesystem implemented using a file system driver.
There are multiple ways to implement this feature using C/C++.
But in your case, using C# means you should use third-party libraries to create a virtual files system.
There is a library called Dokan, which lets you implement a full-featured virtual file system, and you have complete control over its behaviour in your C# project.
it called "Windows Shell namespace"
https://learn.microsoft.com/en-us/windows/win32/shell/namespace-intro
i used EZNameSpace Wrapper for handling this.
there is another library called "CBFS Shell" (formerly shelboost) that you can use.
You could create a dummy file that appears to be correct but is really just a pointer to some code that downloads the correct file. Then use File.Move or File.Copy to replace the dummy file with the actual file.
In my C# WPF application the user have the possibility to import pictures.
Currently the source of the image is referenced to the picture path.
When the picture will be deleted or moved, then my reference is not valid anymore.
How is it managed in applications like Word or Photoshop? Is it possible to embed
the picture at runtime in my custom file? Or should these files copied to a
"image database"?
In Microsoft Word (docx) format. When you paste images in the document, it saves them as file(s). Try this:
Rename the .docx to .zip extension
Extract the zip archive
Now, navigate to the following and you can see all the embeded images here:
You can do something similar for your app. Without knowing the full context and design details its difficult to answer where should the images go.
Generally speaking, images should/could be co-located with the rest of the data that image compliments.
I have a task to programamatically scan a folder for georeferenced images. There might be a lot of images, some quite large, and some not georeferenced. The spatial information can also be either embedded or in a world file.
How can I tell programmatically (C#/WPF/ESRI Runtime) if "C:\someFolder\file.x" is georeferenced?
Thanks
First check the file type to see if it's a format that supports built in georeferencing (GeoTiff, jp2, and MrSid). Other static image files would need some sort of companion file with the georeferencing information. So for each image file you'd want to look for a matching companion file.
If you add some info on what formats the images/world files are in it'll be easier to show you some sample code.
I want to bind a file to a folder so that when the file is moved/copied/deleted the folder is also automatically moved/copied/deleted along with the file (Similar to how html files are linked to the folder containing their resources)
At the moment this behaviour is activated only for html files and their corresponding "htmlFilename_files" folders. Is there a way to register another file extension for such behavior? Or is there a hack or feature that provides similar behavior? Thanks.
Even for HTML this behavior is specific to Explorer.
The problem is that there's no "copy" operation on filesystem level (and Move operation is different from what you see in user mode).
Technically you can create a filesystem filter driver and track RenameOrMove and Delete operations on some file, then perform some operation with the directory. But this won't work for copy which is a sequence of "read" + "write" operations and you would have hard time matching reads and writes (but, well, I can think of some ways to track copying using filter driver as well). You can create a filter driver yourself, but this requires C programming and special knowledge. You can write a driver yourself (read MSDN article) or use our CallbackFilter product (it provides a pre-created driver and .NET API for integration with your software).
If data file is yours, it makes sense to keep all files in one virtual container - this can be MHT file (HTML + supplementary files are combined into MHT by Internet Explorer), ZIP archive or SolFS storage (SolFS is our virtual file system product). Then there's only one file for the user to manage and your application has all files inside.
If you need to let external applications access files in the container, then the virtual disk can be created - such disk will expose contents of the container. Contents of any container can be exposed as a virtual disk using now-dead Dokan or our Callback File System product.
I'm using the flash 10 activex control to load a flash movie into my WinForm. Unfortunately, it only takes a path. What I'm trying to do is load the swf from a stream I can get from an EmbeddedResource so I can embed the swf into my exe such that A) I don't have to worry about paths and B) I don't have my swf quite so exposed - simpler for both usage and deployment.
I know of using f-in-box but I'd like to not add yet another dependency to my project. Is there a way to load the swf into the underlying activex control without having to use a path?
I'm using C# and .Net 3.5sp1.
Is that path always a file path? Or can it be a URL? It should be pretty simple to set up a temp localhost web-server using HttpListener (or similar), that streams back the file in response to an http request.
Another possibility would be named pipes; I wonder if you can convince the control to open a named pipe as though it were a file? (they have a logical file path, after all). I've barely touched these, though - so I can't say 100% whether it would work.
I don't know if flash 10 supports the res protocol to load web content from resource. But I think the web browser control in Windows Forms and WPF support it.
To create a native resource you need an editor of native resource. Visual C++ has one. You can use RC.exe in Windows SDK to compile it to res files before linking in your C# program.
Update:
Looks like the flash plugin for IE does not support the res protocol. embed the .swf file in a resource file and have it load using the movie parameter won't work. Try embed the Flash file in a web archive file (.mht) and add the .mht file to your resource.