Hello I am making an application that use different .wav files.
What i want is to compress those wavs into a .example file with a custom extension and them make my application use those wavs
The point for this is for creating .wav packs so when a user load the .example file it will load the .wav files compressed in the file...
So if i load the file "pack1.bmkv" it will load as i said the .wav files compressed with it.
If this really must be a DLL, then you only need to create a new Project in VS and assign resources to it in the normal way.
However, a much better (and probably easier) way to do it, is to just use a ZIP file with a custom extension and possibly a password.
Related
Suppose, I have a list of MP3 files on my server. And I want a user to download multiple files (which he wants through any means). For, this what i want is to create the zip file dynamically and while saving it into the Output Stream using the dotnetzip or ioniczip libraries.
Well, that's not the perfect solution if the zip file got heavy in size. As, in that scenario the server doesn't support resumable downloads. So, to overcome this approach, I need to handle the zip file structure internally and provide the resume support.
So, is there any library (open source) which i can use to provide resumable dyanamic zip files stream directly to the Output Stream. Or, if possible I will be happy if someone let me know the structure of zip file specially the header content + data content.
Once a download has started, you should not alter the ZIP file anymore. Because then a resume will just result in a broken ZIP file. So make sure your dynamically created ZIP file stays available!
The issue of providing resume-functionality was solved in this article for .NET 1.1, and it is still valid and functional.
I'm trying to create a card game in C# and for this I have alot of images that I need to load. They're all jpg images and there are about 7000 of them.
I would like to make sure that if you download the game, the images will not be easily accessible, meaning that they should not just be JPG images in a sub folder of the application. So I thought about imbedding them in a DLL file.
But how do I do this? And how do I handle this efficiently? Is there a tecnique to this sort of thing, or is another method preferable?
I would like to make sure that [...] the images will not be easily accessible
First, you should ask yourself why you want to forbid this. If you just want to avoid that someone else manipulates the pictures, you can leave them in a bunch of subfolders as JPGs, just generate checksums for each file and check them at the time the program loads the pictures.
If you want to avoid reuse of the pictures, you can leave them in a bunch of subfolders, but not as JPGs. Encode them with for example with the standard AES algorithm. But beware, that won't prevent anyone else of making screenshots while you application is running, so you should consider if that's really worth the effort.
EDIT: if you want to embed the images because installation gets easier when you have just one big file to deploy instead of 7000 single files, then you may write a helper program for creating resource files programmatically. See this page from Microsoft, especially the part about .resource files, to learn how to utilize the ResourceWriter class for that purpose.
If you have 7000 image, you need a database. Microsoft SQL Server Compact 4.0 is an option. It's small and easy to use.
I'm assuming that this is a windows application
In order to Embed a Image to the assembly
1. Right click the Image file and Select properties
2. In the Properties Pane Set the BuildAction as Embeded resource
So this Image becomes a embeded resource when the application is compiled
Then you can access the Image from the assembly like:
global::[[MyNameSpace]].Properties.Resources.[[ImageName]]
for eg:this.pictureBox1.Image = global::[[MyNameSpace]].Properties.Resources.[[ImageName]]
I have an application in c#.net in which I have embeded the SWF file in SWFObject from COM Object.
Now after installation, the original SWF file also available in the application root directory. So from that place(application root directory) anyone can access that file. But I want to restrict that file from being opened.
axShockwaveFlash1.Movie = Directory.GetCurrentDirectory() + "\\XYZ.swf";
I did something like this.
So how can I restrict that file in application root directory such that only from my application I can access it..??
You can embed the file into a dll or exe file and play it from there. this way it is not (as a seperate file) in the file system at all.
For details see How to embed and access resources by using Visual C#.
You could save the swf file binary data as static bytes in your code and statically load them and convert back to an swf file. The conversion might take a little while but it only occurs once as you open the program.
Edit:
But k3b's answer is better.
Permissions are based on users, not applications, so the short answer is you can't. However, you can build your own application-specific authentication pretty easily. Have your SWF require specific FlashVars to be set in order to move beyond frame 1. People can still decompile your SWF but this will at least stop most people. Another option is to try to store the data within you binary somehow and load the SWF using a byte-array, see this post for one attempt at that.
I need to create a Web page that manages a shared folder, which means you can upload and download files, these preferably pdf and a certain size. This shared folder has security therefore must be accessed in any way with user key.
I need to know if there is some sort or some method easy to perform in ASP C#, give me options to view folders and their files created and upload new in a new folder.
I would appreciate your help and advice in order to make this website.
Use System.IO.DirectoryInfo and System.IO.FileInfo to work with a file system from .NET.
Using 'System.IO.FileStream' in one way to create new files from binary data (stream or byte[])
Easy way would be to use a third party control like FileUltimate
Or you can bulid your own custom file manager by using utility classes in System.IO and HttpResponse class for file streaming
You have a library, and one of the function in the library provides a functionality that, among other things output a file (maybe to different paths in every execution). The content and the name of the file is constant in each execution. What is the best way to carry this out? declare the content of the file as a string and print it each time (probably not a good idea, the file is around 1000 lines long)? or have a file which always exist in the same folder as the library dll? How to make sure that the compiler will always include this file? Or is there any better way, for example embedding the file to the dll somehow?
Note that outputting this file is not the only thing that the library do, it's one of the subtasks that is done by a function in the library
Thanks!
If the content is going to be the same in every case and it's non-trivial (i.e. you couldn't just write it out in a couple of small lines of code) then embed it as a resource file in the assembly.
Then you can just use Assembly.GetManifestResourceStream to get an input stream, and copy the data out to a file. (If you're using .NET 4.0, you can use the Stream.CopyTo method and you're done.)
You can create a Resource file in your VS2010 project and have typed access to the file as a static member of an automatically generated class. The resource will then be embedded automatically as well.
Try Add New Item -> Resources File. Once the file is created, drag your file onto the designer surface.
Alternatively there is the file.copy method http://msdn.microsoft.com/en-us/library/system.io.file.copy(VS.71).aspx
You can just include the file with your project (Add existing item) and copy it whenever needed.