Click here to Skip to main content
15,892,298 members
Home / Discussions / C#
   

C#

 
Questionproblem with threading Pin
teejayem14-May-06 7:40
teejayem14-May-06 7:40 
AnswerRe: problem with threading Pin
mikker_12314-May-06 9:43
mikker_12314-May-06 9:43 
Generaltext to speech Pin
Christopher Duncan14-May-06 7:15
Christopher Duncan14-May-06 7:15 
GeneralRe: text to speech Pin
mikker_12314-May-06 9:36
mikker_12314-May-06 9:36 
GeneralRe: text to speech Pin
Christopher Duncan15-May-06 3:24
Christopher Duncan15-May-06 3:24 
QuestionWin32 API - Problems with SENDMESSAGE Pin
Seraphin14-May-06 7:12
Seraphin14-May-06 7:12 
AnswerRe: Win32 API - Problems with SENDMESSAGE Pin
Rei Miyasaka14-May-06 11:09
Rei Miyasaka14-May-06 11:09 
QuestionTrouble in byte\string coding Pin
NaNg1524114-May-06 6:00
NaNg1524114-May-06 6:00 
Well, I tryed to do the TransformFinalBlock but it keeps giving me IndexOutOfRange exception, and I don't know why, which is realy odd because it's not and Index!.
I'll give you the sample code, maybe you can trace what's going on.
the function of encoding is called VigBinEncDec.BothStrEncrypt or Decrypt, it's a simple Vigenere and Binary encryption decryption, and if some-one knows it keeps the number of chars the same (eg. if I input 5 chars it will come out 5 chars - supposably [hehe just made up a word here]!!).
so here is the code, and the exception, but why???

public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
{
    if (VigBinTransformType == Transform.Null)
        throw new NullReferenceException();
    if (inputBuffer == null)
        throw new ArgumentNullException();
    if (inputBuffer.Length < inputOffset + inputCount)
        throw new ArgumentException();

    Byte[] outputBuffer = new Byte[inputCount];
    int outputOffset = 0;

    for (int i = 0; i < inputCount; i++)
    {
        Byte[] newBytes = Encoding.UTF8.GetBytes(VigBinEncDec.BothStrEncrypt(Encoding.UTF8.GetString(new byte[] { inputBuffer[inputOffset + i] }), key));
        if (VigBinTransformType == Transform.Decrypt)
            newBytes = Encoding.UTF8.GetBytes(VigBinEncDec.BothStrDecrypt(Encoding.UTF8.GetString(new byte[] { inputBuffer[inputOffset + i] }), key));

        outputBuffer[outputOffset] = newBytes[0];
        outputOffset++; // IndexOutOfRangeException!!!
    }

    return outputBuffer;
}

AnswerRe: Trouble in byte\string coding Pin
Guffa14-May-06 6:11
Guffa14-May-06 6:11 
GeneralRe: Trouble in byte\string coding Pin
NaNg1524114-May-06 6:31
NaNg1524114-May-06 6:31 
GeneralRe: Trouble in byte\string coding Pin
NaNg1524114-May-06 6:42
NaNg1524114-May-06 6:42 
QuestionRe: Trouble in byte\string coding Pin
NaNg1524114-May-06 6:50
NaNg1524114-May-06 6:50 
AnswerRe: Trouble in byte\string coding Pin
Guffa14-May-06 7:08
Guffa14-May-06 7:08 
GeneralRe: Trouble in byte\string coding Pin
NaNg1524114-May-06 7:12
NaNg1524114-May-06 7:12 
AnswerRe: Trouble in byte\string coding Pin
Guffa14-May-06 22:17
Guffa14-May-06 22:17 
QuestionRichTextBox questions? Pin
Cristoff14-May-06 5:27
Cristoff14-May-06 5:27 
AnswerRe: RichTextBox questions? Pin
Ed.Poore14-May-06 6:17
Ed.Poore14-May-06 6:17 
GeneralRe: RichTextBox questions? Pin
Cristoff14-May-06 9:20
Cristoff14-May-06 9:20 
GeneralRe: RichTextBox questions? Pin
Ed.Poore14-May-06 9:45
Ed.Poore14-May-06 9:45 
GeneralRe: RichTextBox questions? Pin
Cristoff14-May-06 10:12
Cristoff14-May-06 10:12 
QuestionArraySort Pin
zhujp9814-May-06 5:08
zhujp9814-May-06 5:08 
AnswerRe: ArraySort Pin
Josh Smith14-May-06 5:19
Josh Smith14-May-06 5:19 
AnswerRe: ArraySort Pin
Rei Miyasaka14-May-06 10:42
Rei Miyasaka14-May-06 10:42 
Questionsimple sorting of Arraylist ? Pin
kumar.bs14-May-06 3:54
kumar.bs14-May-06 3:54 
AnswerRe: simple sorting of Arraylist ? Pin
Robert Rohde14-May-06 3:56
Robert Rohde14-May-06 3:56 

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.