It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
i read a zip file in my application and i don't want to extract after i read it all ..
i want to extract it while i am reading it.
so how do i extract stream of bytes for a file while i am reading it ?
The GZipStream and DeflateStream classes are wrappers around a normal Stream object. This means that you can extract the data as you're going along before a) the whole file has been downloaded and b) without loading all of the data in to memory.
These are available in .NET 4 upwards, otherwise you'll need to use #ZipLib as suggested.
EDIT:
After looking around it would appear that #ZipLib is definitely the way forwards with this. The same principles apply to these classes in that they are streams, they can work as the file is being downloaded or read over a network and they don't require the whole file to be in memory. I'm currently using it in a project to open zip files from an http server, so I've seen it in action!
The .NET Base Class Library doesn't include classes to stream .zip files. Take a look at SharpZipLib.
Here are various examples of compression/decompression using the #Zip library.
http://wiki.sharpdevelop.net/SharpZipLib-Zip-Samples.ashx
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm in my first year studying .Net and came to the chapter, "An Introduction to the System.IO classes"
I'm just curious to know what the .IO stands for. I do understand that this is learning about how to use Directories, Files and paths.
IO itself stands for Input/Output.
This is the entire System.IO namespace: http://msdn.microsoft.com/en-us/library/system.io.aspx
You're probably going to cover directories, files, and streams.
'IO' is the standard acronym for Input/Output. The System.IO namespace contains all the classes that deal with input/outputs like reading/writing files.
IO stands for Input and Output. Basically System.IO contains methods for reading and writing files as well as using Streams like you have said already.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am writing a C# asp.net web application that receives CV's in various formats i.e. doc, docx, pdf, text, etc.
I was wondering if there was a simple way I could remove certain information from the document not matter what file type it is and then pass on the edited file to the end user?
The information to be removed will be held in a string
You will need to parse each file type using separate APIs.
.docx can be parsed using: http://docx.codeplex.com/
.pdf can be parsed using: http://www.pdfsharp.net/
etc.
If you use a streamreader (http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx) to read through the document, you could use the ReadToEnd function to store everything in a string, then use the function:
MyString.Replace("Something to replace", "");
to remove the matches. If the file formats cannot be read in as a string, you'll have to consider different options. However, there are likely faster solutions given the file formats, and it's likely not stored as simply.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm sorry but it seems a very silly question, but if i have a format let it be .epub for example and want to build a class (C# class) that can read it, what should I do. I'm not talking about a certain format or certain language, but I'm asking about building an interface that can read/write this format. vaguely I guess COM object should do this but i haven't dealt with them and get tired of learning any concepts and technology to find that it is irrelevant to my needs. thank you in advance and sorry for this very loose. question
If you know the format of the file then the only specific thing you need to do is create a class that will read/write that format. The internal structure of the class can be represented however you want.
To write the format just use System.IO.FileStream and/or System.IO.StreamWriter. If the file is represented in hex data then use a BinaryReader or BinaryWriter.
The process of reading/writing a file is then just a matter of parsing the data into your internal representation in code, when reading, so you can edit it and then writing out the data according to the file format spec.
Here is a link on file formats just in case. If you have a more specific question ask it and you can get more specific help and/or examples.
EDIT:
If you are looking for the EPUB spec it is Here. I'm afraid that you are going to have to read the spec for any file format that you plan on creating a class for, which can be tedious. I had to do this for PDF documents recently. Just make sure you can understand the spec, look at examples and try different things out when writing/reading. This is really the only thing you can do.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I found there's quite a lot of IP Camera libraries for C# on the net. In case you have worked with any of them, which seem to be the best?
Thanks!
Emgu CV is an open source C# wrapper for Open-CV which is a robust open source library for image processing and more. It has some out of the box webcam image capturing examples using only seven lines of code.
The web cam part look like it was address in this question.
Getting the camera stream through (httprequest)webrequest is not a huge deal. Most cameras will send the video back in an MJPEG stream. The stream is just a multi-part message that is broken up by a delimiter, specified in the head section of the response, and two carriage returns. The data inbetween the delimiters are JPEG images which you can feed into the wrapper for the CV library.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
im the beginner of .net, im doing the project to save and retrive the files in asp.net with c# , i done saved the files to sql in binary format,
and i dont know how to retrive the file in grid view,
also i dont know how to play the video file in gridview,
can any one help to make that please..
It is not a good practice to save large sized files (like video,documents etc) in database (as binary or varbinary). Instead you upload them to a structured folder outside root and save only the file name(name/path) in the database.
If you really want to do as you asked do the following steps:
1. Convert the binary file to a byte array as follows,
byte[] byteArray=GetBinaryFromDB().TOArray();
2. Then pass the byte array to the following function within System.IO namespace,
File.WriteAllBytes (strng path, byte[] bytes) //This will save your file in the path you specified as first argument.
In order to play the video file you should design a suitable API (including a flash movie,light box/light window etc)..