Questions tagged [memorystream]

1

votes
0

answer
69

Views

A generic error occurred in GDI+ when resizing image in MemoryStream

I am using ImageProcessor to process images in my website. I have this resize function: public Image ResizePhoto6version(Image img, int width, int height) { using (var ms = new MemoryStream()) { using (var imgf = new ImageFactory(false)) { imgf.Load(img) .Resize(new ResizeLayer(new Size(width, heigh...
Idan Shechter
1

votes
0

answer
70

Views

What is the purpose of using memory stream in the C standard library?

In the C standard library, what is the purpose of using memory stream (as created for an array via fmemopen())? How is it compared to manipulating the array directly? Thanks.
Ben
1

votes
2

answer
3.1k

Views

Creating memory stream from ResponseStream Out of Memory Exception

I am making a call to a httprequest which returns a pdf file in the responsestream. This works well for smaller pdf's, but not the file is up around 25-30MB, it is returning an out of memory exception. MemoryStream memStream = new MemoryStream(); byte[] buffer = new byte[2048]; int bytesRead = 0; d...
mickyjtwin
1

votes
1

answer
98

Views

Overloaded signification on msdn

I don't understand what does the overloaded term mean in the context of msdn library's page for MemoryStream Close method (or others like Dispose). See the page here. To me, overloaded points out the fact that you are providing a method with the same name but different signature than an existing one...
Stringer
1

votes
1

answer
1.6k

Views

MemoryStream.Position or MemoryStream.Seek does not work (Silverlight)

I have a memorystream in a silverlight app. I have to copy this memorystream to a filestream object. If I call: memoryStream.Position = 0; memoryStream.Seek(0,SeekOrigin.Begin); It does not work, I debug the application, check the properties of the memorystream, and the position still points to the...
VolkanUzun
1

votes
1

answer
1.9k

Views

Serialize WPF component using XamlWriter without default constructor

Ive found out that you can serialize a wpf component, in my example a FixedDocument, using the XamlWriter and a MemoryStream: FixedDocument doc = GetDocument(); MemoryStream stream = new MemoryStream(); XamlWriter.Save(doc, stream); And then to get it back: stream.Seek(0, SeekOrigin.Begin); FixedDoc...
Mizipzor
1

votes
1

answer
681

Views

SharpSvn - how to save changes from MemoryStream without working copy

I have this code which gets a uri's content into a MemorySream: MemoryStream ms = new MemoryStream(); SvnTarget target = new SvnUriTarget(new Uri(webConfigUri)); client.Write(target, ms); string webConfigText = Encoding.ASCII.GetString(bms.ToArray()); webConfigText = webConfigText.Replace(oldLine, n...
Dave
1

votes
1

answer
329

Views

Ink to memorystream problem

I was trying to convert an ink from Microsoft.Ink namespace to memorystream, so to convert it to image, but I don't understand why it's getting an error in the memorystream. I kind of felt that it was an error from Convert.FromBase64String() But I don't know what other choices I have to convert it t...
Corbee
1

votes
1

answer
1.7k

Views

Get image from resource dll as MemoryStream

I use WPF and my program has images in a DLL resource file. I have this well working way to read in images from disk: Private Function GetImageFromFile(ByVal fileName As String) As BitmapImage Dim buffer As Byte() = IO.File.ReadAllBytes(fileName) Dim memoryStream As New IO.MemoryStream(buffer) Dim b...
Gabe Miller
1

votes
1

answer
874

Views

XML And MemoryStream?

MemoryStream oMemoryStream = Common.DecrypetXML(FilePath); XmlDocument oXmlDocument = new XmlDocument(); oXmlDocument.Load(oMemoryStream); //Check if year exists if (oXmlDocument.DocumentElement.SelectSingleNode('//Year[@Year='' + Year + '']') == null) { XmlElement oNewYearElement = oXmlDocument.Cre...
ykh
1

votes
2

answer
3k

Views

Combine multiple byte array images into one

I can create an image on the server from a byte array stored in the database. But how do I combine each byte array into one image. Basically I want to stack them on top of each other (they are all 1366px width and 618px height) and then save that to a png image. I will then get that image from the...
Rob
1

votes
1

answer
1.7k

Views

Using MVCMailer to embed image from MemoryStream in email

I use MVCMailer with asp.net MVC 3. It's a great library but I have a problem. I saw it's possible to embed image in email like so : var resources = new Dictionary(); resources['image'] = imagePath; PopulateBody(mailMessage, 'WelcomeMessage', resources); Therefore it looks like 'resources' is expect...
Dragouf
1

votes
1

answer
1.5k

Views

Send content of memory pointed by an IntPtr into a MemoryStream variable on C#

Im new to this languaje. I think the question is very clear, i have an intptr received after calling a dll function and need to save the buffer that it points to into a MemoryStream variable. ¿how do i do it ?
Martin
1

votes
1

answer
113

Views

Facing issue While working on incoming TCP network stream

I'm trying to upload files(blob) to Azure storage through FTP service by reading the incoming TCP network stream. Whenever I try to perform operations like stream.length, stream.seek in the Uploadblob Method, I get following Unhandled exception: Unhandled Exception! Error ID: 0 Error Code: Unknow...
Vivek Misra
1

votes
1

answer
433

Views

System.ArgumentException at System.Drawing.ImageFromStream

Ok, so I've seen multiple people with this issue, and I've found to some extent what might be causing the issue, but I can't figure out how to fix it. Basically, I'm trying to send a screenshot from a client to a server via sockets. I take the screenshot on the client application and use this method...
user1742916
1

votes
2

answer
1.3k

Views

Read from process stdout into memory stream asynchronously

UPDATE: The key part is that the stream we are using is too large for the buffer used by copyto\copytoasync and so rather than running the whole task asynchronously, we need to asynchronously process the stream in parts, like the question linked to below Please excuse the VB.net code here. I also sp...
beyond-code
1

votes
1

answer
9.9k

Views

open byte array from memory stream in new tab or window

This seems to be a common problem but after a lengthy search I have yet to find a solution that fits my needs. I am using itextsharp to fill out a pdf form from which i create a byte array. (There are multiple pages of the same form with the same information that I combine into a single pdf docume...
ovaltein
1

votes
2

answer
772

Views

Convert memorystream to double-array?

I've got a pcm-stream of raw music data from a wave-file and would like to convert it to a double-array (to apply a fft afterwards). The result I got now contains very high or low double-numbers (1.0E-200 and 1.0E+300) and I'm not sure whether these can be correct. This is the code I'm using right n...
Hedge
1

votes
2

answer
647

Views

Cropping Centre of Image Stored In A MemoryStream

I have an image upload form that stores two sizes of images: Large and Thumbnail image. For the thumbnail image, I am trying to crop image from the center and re-size to: 30px x 30px. Here is my code: private static Bitmap ResizeImage(MemoryStream uploadStream, int maxWidth, int maxHeight) { Image i...
sbhomra
1

votes
1

answer
1.4k

Views

Building and sending very large CSV data-set over C# WCF REST Web Service as MemoryStream

This topic is related to the question here: How to send a CSV file using C# WCF RESTful (i.e. Web) Service? I was able to send a very small data set by utilizing the method discussed at http://blogs.msdn.com/b/carlosfigueira/archive/2008/04/17/wcf-raw-programming-model-web.aspx, which explains how t...
user717236
1

votes
2

answer
251

Views

How can I check result of adding to a MemoryStream, before adding to the MemoryStream?

I am creating an XML file using a Memory stream, in the following manner - XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; MemoryStream ms = new MemoryStream(); using (XmlWriter writer = XmlWriter.Create(ms, settings)) { // CREATE XML WITH STATEMENTS LIKE THIS writer.Wr...
A Bogus
1

votes
1

answer
966

Views

Display high resolution image

I'm saving both high resolution and compressed version of high resolution image in the database. When the user requests a high resolution image, i need to display that else the compressed one. here is my code. The issue is : when i set that image byte array into a stream and bitmap, file size has...
Aruna
1

votes
2

answer
151

Views

C++ (Qt), System command using memory buffers instead of redirection

I would like to know how to use memory buffers as the io streams to a system command using Qt. Normally you would do something pseudocode like: Exec Command(' command < inputfile > outputfile'); but I would like to do the entire operation in memory. I would prefer Something psudocode like: ByteArray...
Bruce Chidester
1

votes
2

answer
414

Views

Accessing base memorystream [for read] in a binarywriter

I have a binarywriter that is backed by a memorystream as such: BinaryWriter m_binaryWriter = new BinaryWriter(new MemoryStream(BUFFER_SIZE)); I want to get the base reader and read it into a byte array: long DataLength = m_binaryWriter.BaseStream.Length; byte[] MemoryStrData = new byte[DataLength];...
bge0
1

votes
2

answer
1.2k

Views

Save and load multiple memory streams in one file C#

I've got two memory streams that each contain serialized structures. Is it possible to combine these two streams into one file, in a way that can later be read and extracted back into the original two memory streams? EDIT: I should specify that the reason my data is split into two streams at all is...
user3154397
1

votes
2

answer
951

Views

Create PDF file thru an online text editor and save it directly to the web server filesystem ASP.NET MVC

Hi my question is this possible? I am currently using TinyMce and Itextsharp to create a pdf file but my problem is when I save it requires to be saved in the client's pc which is not needed I only want to saved it directly to the web server file system for the user to download anytime he wants. so...
StackOverlord
1

votes
1

answer
516

Views

Writing to memory in .NET and pick up data of process in labview

I am using the Kinect Face-Tracking Basics WPF example to collect data from an object. I can access the data in a text file etc but I want to write the data to managed memory in a C# process and have labview's .NET program pick up the data from same location. So far, this is what I've got: this.face...
Calorified
1

votes
1

answer
542

Views

Reusing Streams in a UDP Server

I'm writing a UDP server and am wanting to reduce the number of allocations that are taking place per incoming and outgoing datagram packets. One of the things I'd like to do is re-use the Streams I'm allocating to read and write my datagram packets. I have this method that uses an instance of a Bi...
1

votes
1

answer
282

Views

how can i modify a small section of bytes in a memory stream, that was written to using binarywriter

how do i edit the first four bytes in memory stream? Imagine 'bytes' in the following code is a few 100 bytes long. i need to write a place holder of say, 4 bytes of value 0 and come back and update those bytes to new values. static MemoryStream stream = new MemoryStream(); static BinaryWriter write...
netnoob
1

votes
1

answer
477

Views

Uploading document body to SharePoint from CRM Notes C#

I am able to upload the document but when I'm viewing/downloading it, there seems to be an error. It says it ran into a problem opening this PDF. Ran into a problem I have the following code using (var stream = new System.IO.MemoryStream()) { byte[] myByte = System.Text.ASCIIEncoding.Default.GetByte...
Judah Endymion
1

votes
1

answer
1.7k

Views

How do I convert a VarBinary Value to an image?

I have a Table in my database like so: Id | Description | Icon where the Icon column is of type varbinary(max) I have a row in this table where the value in the Icon column is shown in the pastebin link (because it is a long value): http://pastebin.com/LbVAf20A I am trying to convert this varbina...
user1
1

votes
1

answer
166

Views

big-endian BinaryReader gives wrong value when reading long

I am currently working on a socket server. The client sends data in BigEdian format so I Decided to use this package. But for Int64 it gives me a different value This is the test code. It works fine for int32 long val = ((long)868324021119164); byte[] longval = BitConverter.GetBytes((long)8683240211...
Jan-Fokke
1

votes
1

answer
2.8k

Views

how to get all the data to CSV from memorystream?

Below is my method to export data to CSV. public MemoryStream ExportToCsv(string jsonData, HttpResponseBase response, string fileName) { using (MemoryStream stream = new MemoryStream()) { StreamWriter writer = new StreamWriter(stream); try { String s = JsonToCsv(jsonData, ','); writer.Write(s); stre...
Kgn-web
1

votes
1

answer
159

Views

How can I write to a FileStream from a Memorystream starting from a non-zero position?

I need to write from a Memorystream to a simple Filestream. The problem is that my memorystream holds the file name and its sequence of bytes separated with a '|'. So it is something like this: name.extension|BYTES. The code I use to write now is: Dim j As Integer = 1 Dim name As String name = '' ms...
Dadex
1

votes
1

answer
78

Views

.net MemoryStream, StreamWriter, FileStream combo causes special character when combining

Hi I have the following code which I have reduced down from a bigger task I am working on. Essentially though I have found that when combining memory streams together I am getting a special character on the join position. Below is the code for the app to run in full which shows the problem. Openi...
Matt
1

votes
1

answer
324

Views

Return stream immediately and then write to stream asynchronously

In my current code I have a method like this to read data from a device (pseudo code): public async Task ReadAllDataFromDevice() { var buffer = ''; using (var device = new Device()) { while(device.HasMoreData) { buffer += await device.ReadLineAsync(); } } return buffer; } I then want to send all tha...
Robert Hegner
1

votes
2

answer
139

Views

How to write to MemoryStream if many messages are sent

Here is how i read data from my stream now: public List clients = new List(); while (true) { Update(); } private void Update() { //Console.WriteLine('Call'); if (!serverStarted) { return; } foreach (ServerClient c in clients.ToList()) { // Is the client still connected? if (!IsConnected(c.tcp)) { c....
Venelin Vasilev
1

votes
2

answer
563

Views

NAudio is not reading MemoryStream containing wav data

I'm trying to use NAudio to record 8 seconds of streaming audio, store it in System.IO.MemoryStream, and then play it back right after. To do this, I'm running the following code: using System.IO; using NAudio.Wave; public class AudioCapture{ static WaveFileWriter wri; static bool stopped = false; p...
Skylar Kennedy
1

votes
1

answer
336

Views

Returning an image with MemoryStream and WebApi

I'm trying to make an endpoint return a MemoryStream containing an image. This is the code I have so far: Controller endpoint: [Route('v1/consumer/profile-image')] [HttpGet] public async Task GetProfileImage(string id) { var result = await ImageService.GetImage(true, id); var response = new HttpResp...
TomSelleck
1

votes
2

answer
823

Views

Streaming video files in asp.net core 2

I want to play video in browser using asp.net core in html I have Your browser does not support the video tag. and in asp.net core 2 [HttpGet] [Route('Download')] public async Task Download() { var path = @'d:\test\somemovie.mp4'; var memory = new MemoryStream(); using (var stream = new FileStrea...
unos baghaii

View additional questions