Click here to Skip to main content
15,889,116 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionhow to extrack an image from an email and save it on a disk Pin
Member 798388410-Aug-12 18:17
Member 798388410-Aug-12 18:17 
AnswerRe: how to extrack an image from an email and save it on a disk Pin
Richard MacCutchan10-Aug-12 21:53
mveRichard MacCutchan10-Aug-12 21:53 
Questionsession variables Pin
sc steinhayse10-Aug-12 17:28
sc steinhayse10-Aug-12 17:28 
AnswerRe: session variables Pin
Shameel14-Aug-12 0:40
professionalShameel14-Aug-12 0:40 
QuestionReading data from Excel Pin
indian14310-Aug-12 7:15
indian14310-Aug-12 7:15 
AnswerRe: Reading data from Excel Pin
jkirkerx10-Aug-12 10:33
professionaljkirkerx10-Aug-12 10:33 
GeneralRe: Reading data from Excel Pin
indian14310-Aug-12 12:28
indian14310-Aug-12 12:28 
GeneralRe: Reading data from Excel Pin
jkirkerx10-Aug-12 19:12
professionaljkirkerx10-Aug-12 19:12 
I thought you just wanted to store the file. Yes You can do that, but i don't how.

Guess you cross that road when you get to it. if your able to store the byte array.

With all do respect, meaning something else

I find it hard to believe that your selling services that you have no clue how to do.
I don't mind helping you, but eventually you need to give something back to CJ, like answer some questions for other OPs, and not be a pure consumer

This reads the dimensions of a flash file from a pure byte stream, just an in insight into what you wish to achieve. I have no interest in reading a excel file, so I'm stopping here at this point. When you ready to ready bytes and translate them into bits, let me know.

Private Function getDimensions(ByVal stream As Stream) As Rectangle

        Dim inputStream As Stream = Nothing
        Dim signature() As Byte = New Byte(8) {}
        Dim rect() As Byte = New Byte(8) {}
        stream.Read(signature, 0, 8)

        If (System.Text.Encoding.ASCII.GetString(signature, 0, 3) = "CWS") Then
            inputStream = New InflaterInputStream(stream)
        Else
            inputStream = stream
        End If

        inputStream.Read(rect, 0, 8)
        Dim nbits As Integer = rect(0) >> 3
        rect(0) = Convert.ToByte(rect(0) And &H7)
        Dim bits As String = ByteArrayToBitString(rect)
        bits = bits.Remove(0, 5)
        Dim dims() As Integer = New Integer(4) {}

        For i As Integer = 0 To 3
            Dim dest() As Char = New Char(nbits) {}
            bits.CopyTo(0, dest, 0, If(bits.Length > nbits, nbits, bits.Length))
            bits = bits.Remove(0, If(bits.Length > nbits, nbits, bits.Length))
            dims(i) = BitStringToInteger(New String(dest)) / 20
        Next

        Return New Rectangle(0, 0, dims(1) - dims(0), dims(3) - dims(2))

    End Function
Private Function BitStringToInteger(ByVal bits As String) As Integer

        Dim converted As Integer = 0

        For i As Integer = 0 To bits.Length - 2
            converted = (converted << 1) + If(bits(i) = "1", 1, 0)
        Next

        Return converted

    End Function
    Private Function ByteArrayToBitString(ByVal byteArray() As Byte) As String

        Dim newByteArray() As Byte = New Byte(byteArray.Length) {}

        Array.Copy(byteArray, newByteArray, byteArray.Length)
        Dim converted As String = ""

        For i As Integer = 0 To newByteArray.Length - 1
            For j As Integer = 0 To 7
                converted += If((newByteArray(i) And &H80) > 0, "1", "0")
                newByteArray(i) <<= 1
            Next
        Next

        Return converted

    End Function

Question(Input string was not in a correct format) with ExecuteReader Pin
Jassim Rahma10-Aug-12 2:33
Jassim Rahma10-Aug-12 2:33 
AnswerRe: (Input string was not in a correct format) with ExecuteReader Pin
WebMaster10-Aug-12 2:52
WebMaster10-Aug-12 2:52 
AnswerRe: (Input string was not in a correct format) with ExecuteReader Pin
Parthi Bun10-Aug-12 3:06
Parthi Bun10-Aug-12 3:06 
AnswerRe: (Input string was not in a correct format) with ExecuteReader Pin
StianSandberg10-Aug-12 3:26
StianSandberg10-Aug-12 3:26 
GeneralRe: (Input string was not in a correct format) with ExecuteReader Pin
Jassim Rahma10-Aug-12 4:03
Jassim Rahma10-Aug-12 4:03 
GeneralRe: (Input string was not in a correct format) with ExecuteReader Pin
Jassim Rahma11-Aug-12 9:11
Jassim Rahma11-Aug-12 9:11 
AnswerRe: (Input string was not in a correct format) with ExecuteReader Pin
Shameel14-Aug-12 0:46
professionalShameel14-Aug-12 0:46 
Questionasp.net Pin
Rajesh.paka10-Aug-12 2:08
Rajesh.paka10-Aug-12 2:08 
AnswerRe: asp.net Pin
Wes Aday10-Aug-12 4:00
professionalWes Aday10-Aug-12 4:00 
Questionstrange issue with cache application block (ENT LIB 5) Pin
Luca Dominici9-Aug-12 23:23
Luca Dominici9-Aug-12 23:23 
AnswerRe: strange issue with cache application block (ENT LIB 5) Pin
Pete O'Hanlon10-Aug-12 0:42
mvePete O'Hanlon10-Aug-12 0:42 
AnswerRe: strange issue with cache application block (ENT LIB 5) Pin
jkirkerx10-Aug-12 10:12
professionaljkirkerx10-Aug-12 10:12 
Questiondebug javascript Pin
dcof9-Aug-12 18:44
dcof9-Aug-12 18:44 
AnswerRe: debug javascript Pin
AnnieCalvert9-Aug-12 20:09
AnnieCalvert9-Aug-12 20:09 
GeneralRe: debug javascript Pin
dcof10-Aug-12 4:31
dcof10-Aug-12 4:31 
GeneralRe: debug javascript Pin
enhzflep10-Aug-12 4:59
enhzflep10-Aug-12 4:59 
Generalwindow open Pin
dcof9-Aug-12 12:16
dcof9-Aug-12 12:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.