FAQ Database Discussion Community


play audio periodically from a memory stream c#

c#,audio,windows-phone-8.1,memorystream
I have some buffer containing samples of sinus which I want to be played from a memory stream periodically. Is there any efficient way to play it without having gaps in time? I try to make my own signal generator (I know that are some libraries providing that but I...

Should I use Stream.Flush before Stream.CopyTo?

c#,.net,stream,memorystream
I have MemoryStream that I'm filling up with some data using StreamWriter. At the end I want to dump it to different stream (not always file). Should I call Stream.Flush before using Steram.CopyTo method?...

Memory Stream Byte Array vs ImageConverter Byte Array

c#,bytearray,memorystream
I am converting a image to a byte array, then converting the bytes into something my epson printer can print this piece of code converts the picture into bytes fast ImageConverter converter = new ImageConverter(); buff = (byte[])converter.ConvertTo(signature, typeof(byte[])); this one is slow but works public static byte[] ImageToByte2(Image img)...

MVC converting images before upload

c#,.net,image-processing,model-view-controller,memorystream
I have an application that uploads images into a blob in azure. My issue is that I need to convert images into Jpeg before the upload. my solution seemed to work, but nothing would get uploaded. Azure shows the name of the blob, but a size of 0B is shown....

Trying to read an Excel file file stream in C#, I get numbers instead of text

c#,excel,openxml,memorystream
I'm trying to use DocumentFormat.OpenXml to read an uploaded Excel file. When I get the file (HttpPosteFileWrapper) I'm simply trying to read the cells and write them to a text string. (Later I will do more, but I'm just trying to get used to OpenXml right now.) My data in...

Stream.CopyTo(newStream) return Length 0

audio,windows-phone-8.1,memorystream
I try to make some concatenation of buffers which are saved in a memory streams. Then, when I'm trying to play the whole buffer it gives an exception: An exception of type 'System.ArgumentException' occurred in Microsoft.Xna.Framework.ni.dll but was not handled in user code Additional information: Ensure that the buffer length...

Add multiple pages to pdf form with iTextSharp

c#,itextsharp,memorystream
I am trying to fill out a pdf form and the form could have multiple pages of the same form, so instead of writing each one to disk I want to create one pdf document in memory with all the pages. I have seen plenty of example on adding pages...

Email Attachment from memory stream is coming as blank in C#

c#,.net,email,email-attachments,memorystream
I am able to send an attachment in a mail but the attachment content is blank and size is being shown as 0 bytes. After doing some search over the internet found that we need to reset the memory stream position to 0 in order to start from start. I...

Trying to convert a ZipArchiveEntry into a byte[]

c#,memorystream
I am trying to take a list of ZipArchiveEntrys and convert them into byte arrays, but I am logistically running into a wall. So far I am trying to convert it into a MemoryStream to convert it into the byte[] like this: public static void ScanUpload(List<ZipArchiveEntry> scan) { foreach (var...

Read a stored PDF from memory stream

c#,.net,pdf,memorystream
I'm working on a database project using C# and SQLServer 2012. In one of my forms I have a PDF file with some other information that is stored in a table. This is working successfully, but when I want to retrieve the stored information I have a problem with displaying...

XmlReader(Stream(fileName) -> MemoryStream) slower than XmlReader(fileName)

c#,performance,stream,xmlreader,memorystream
Please forgive my bad english. I want to read large XML files (> 2GB). I saw several posts about it and figured out to use XmlReader. For test purposes, I have created a 500MB XML and make 2 code : First one : MemoryStream mem = new MemoryStream(); Stream file...

Clear MemoryStream after passing the objects to a different function

c#,smtp,itextsharp,memorystream
My main question is if I pass object to a function that are using a MemoryStream how to I go about clearing the memorystream? See my code below. In more detail: I'm trying to send multiple emails while creating PDFs on the fly using iTextSharper. I want to make sure...