Click here to Skip to main content
15,897,187 members
Home / Discussions / C#
   

C#

 
AnswerRe: Update SQL Database in C# Pin
Lubomír Baloga3-May-14 6:00
Lubomír Baloga3-May-14 6:00 
GeneralRe: Update SQL Database in C# Pin
Richard MacCutchan3-May-14 6:34
mveRichard MacCutchan3-May-14 6:34 
GeneralRe: Update SQL Database in C# Pin
V.5-May-14 2:24
professionalV.5-May-14 2:24 
AnswerRe: Update SQL Database in C# Pin
Eddy Vluggen3-May-14 7:39
professionalEddy Vluggen3-May-14 7:39 
AnswerRe: Update SQL Database in C# Pin
Praneet Nadkar8-May-14 18:24
Praneet Nadkar8-May-14 18:24 
QuestionHow to add panel and its control to PDF by using iTextSharp.? Pin
Member 98521082-May-14 21:50
Member 98521082-May-14 21:50 
SuggestionRe: How to add panel and its control to PDF by using iTextSharp.? Pin
Richard MacCutchan2-May-14 22:39
mveRichard MacCutchan2-May-14 22:39 
QuestionAudio Steganography C# (Code not working) Invalid file format exception [NEED HELP] Pin
Member 105917362-May-14 8:09
Member 105917362-May-14 8:09 
NEED HELP!!
My project is 'digital steganography' in which we are doing image, audio and video steganography. We taken help from CodeProject, image is working properly but in audio steganography im stucking somewhere...

here is the code snippet:
WaveStream.cs
private void CopyHeader(Stream destinationStream)
{
BinaryReader reader = new BinaryReader(m_Stream);
BinaryWriter writer = new BinaryWriter(destinationStream);

if (CopyChunk(reader, writer) != "RIFF")
throw new Exception("Invalid file format");

writer.Write( reader.ReadInt32() ); // File length minus first 8 bytes of RIFF description

if (CopyChunk(reader, writer) != "WAVE")
throw new Exception("Invalid file format");

if (CopyChunk(reader, writer) != "fmt ")
throw new Exception("Invalid file format");

int len = reader.ReadInt32();
if (len < 16){ // bad format chunk length
throw new Exception("Invalid file format");
}else{
writer.Write(len);
}

m_Format = new WaveFormat(22050, 16, 2); // initialize to any format
m_Format.wFormatTag = reader.ReadInt16();
m_Format.nChannels = reader.ReadInt16();
m_Format.nSamplesPerSec = reader.ReadInt32();
m_Format.nAvgBytesPerSec = reader.ReadInt32();
m_Format.nBlockAlign = reader.ReadInt16();
m_Format.wBitsPerSample = reader.ReadInt16();

//copy format information
writer.Write( m_Format.wFormatTag );
writer.Write( m_Format.nChannels );
writer.Write( m_Format.nSamplesPerSec );
writer.Write( m_Format.nAvgBytesPerSec );
writer.Write( m_Format.nBlockAlign );
writer.Write( m_Format.wBitsPerSample );


// advance in the stream to skip the wave format block
len -= 16; // minimum format size
writer.Write( reader.ReadBytes(len) );
len = 0;
/*while (len > 0)
{
reader.ReadByte();
len--;
}*/

// assume the data chunk is aligned
while(m_Stream.Position < m_Stream.Length && CopyChunk(reader, writer) != "data")
;

if (m_Stream.Position >= m_Stream.Length)
throw new Exception("Invalid file format");


m_Length = reader.ReadInt32();
writer.Write( m_Length );

m_DataPos = m_Stream.Position;
Position = 0;
}


_______________________________________________________

in above snippet im getting exception thrown from here:

if (m_Stream.Position >= m_Stream.Length)
throw new Exception("Invalid file format");

im doing it for .wav file, please help.
Krrish8891

AnswerRe: Audio Steganography C# (Code not working) Invalid file format exception [NEED HELP] Pin
CHill602-May-14 8:46
mveCHill602-May-14 8:46 
QuestionItextsharp , count each page rows OnStartpage Pin
mohammadkaab2-May-14 1:46
mohammadkaab2-May-14 1:46 
QuestionRe: Itextsharp , count each page rows OnStartpage Pin
GuyThiebaut2-May-14 2:01
professionalGuyThiebaut2-May-14 2:01 
AnswerRe: Itextsharp , count each page rows OnStartpage Pin
mohammadkaab2-May-14 2:33
mohammadkaab2-May-14 2:33 
GeneralRe: Itextsharp , count each page rows OnStartpage Pin
GuyThiebaut2-May-14 2:37
professionalGuyThiebaut2-May-14 2:37 
GeneralRe: Itextsharp , count each page rows OnStartpage Pin
mohammadkaab2-May-14 3:03
mohammadkaab2-May-14 3:03 
GeneralRe: Itextsharp , count each page rows OnStartpage Pin
GuyThiebaut2-May-14 3:29
professionalGuyThiebaut2-May-14 3:29 
QuestionHttpRuntime Cache value automatically cleares in idle state Pin
Kathirvelu.M2-May-14 1:06
Kathirvelu.M2-May-14 1:06 
SuggestionRe: HttpRuntime Cache value automatically cleares in idle state Pin
Richard MacCutchan2-May-14 1:13
mveRichard MacCutchan2-May-14 1:13 
QuestionHave I implemented this well - code critique & tips please? Pin
Kevin Bewley2-May-14 0:07
Kevin Bewley2-May-14 0:07 
QuestionFile refuses to delete Pin
Kasun Liyanage1-May-14 1:01
Kasun Liyanage1-May-14 1:01 
AnswerRe: File refuses to delete Pin
Richard Deeming1-May-14 1:06
mveRichard Deeming1-May-14 1:06 
GeneralRe: File refuses to delete Pin
Kasun Liyanage1-May-14 1:09
Kasun Liyanage1-May-14 1:09 
GeneralRe: File refuses to delete Pin
Richard Deeming1-May-14 1:11
mveRichard Deeming1-May-14 1:11 
GeneralRe: File refuses to delete Pin
Kasun Liyanage1-May-14 2:24
Kasun Liyanage1-May-14 2:24 
QuestionI want to write a tool for work and I don't know if C# is the right tool - If so, I'd love it if someone knew of a sample Pin
Member 1041949730-Apr-14 12:30
Member 1041949730-Apr-14 12:30 
AnswerRe: I want to write a tool for work and I don't know if C# is the right tool - If so, I'd love it if someone knew of a sample Pin
Pete O'Hanlon30-Apr-14 12:44
mvePete O'Hanlon30-Apr-14 12:44 

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.