[MonoDevelop] Hex editor as a widget for my application?

Tom Spink tspink at gmail.com
Mon Aug 30 17:58:25 EDT 2010


Hi Rampage,

After a quick scan of the Buffer.cs source-code, I think it's because
the stream needs to be reset, in order for the buffer to read the data
properly.  Try adding this line, after initialising the stream, and
before allocating the ArrayBuffer:

///
mystream.Position = 0;
///

And see what happens.

-- Spink.

On 30 August 2010 22:51, Rampage <atomikramp at email.it> wrote:
> Hi Tom,
> thak you for the fast reply,
> unluckly this doesn't change the result, still 0es in my hex widget.
>
> the byte array is filled with data, as it's used in other parts of the
> program (like a gdk.pixbuf) and the image is displayed properly.
>
> so i dunno what i'm doing wrong :(
>
> Rampage.
>
> Tom Spink ha scritto:
>> Hi Rampage,
>>
>> Firstly, I take it you are initialising the byte array with data?
>>
>> Also, the constructor of a memory stream accepts a byte array as a parameter:
>>
>> ///
>> var memStream = new MemoryStream(myByteArray);
>> ///
>>
>> Try using that, to see if it makes a difference.
>>
>> -- Spink.
>>
>> On 30 August 2010 22:32, Rampage <atomikramp at email.it> wrote:
>>
>>> Rampage ha scritto:
>>>
>>>> Abe Gillespie ha scritto:
>>>>
>>>>
>>>>> Make sure you're building against the latest Mono assembly versions.
>>>>> Do this by right-clicking your project > Options > Build > Runtime
>>>>> version > <select the highest Mono / .NET profile>
>>>>>
>>>>> If that doesn't work then you probably need a newer Mono and MonoDevelop.
>>>>>
>>>>> -Abe
>>>>>
>>>>> On Mon, Aug 30, 2010 at 11:37 AM, Rampage <atomikramp at email.it> wrote:
>>>>>
>>>>>
>>>>>
>>>> Oh yeah, now it works, thank you very much, now i need some api doc on
>>>> how to use it.. is there anything on the mono documentation?
>>>>
>>>> thanks
>>>>
>>>> Francesco
>>>>
>>>>
>>> Ok, here we go, i've managed to understand (probably) how to load stuff
>>> into the hex editor widget.
>>>
>>> but i have a problem:
>>> if i do:
>>>
>>> using Mono.MHex;
>>> using Mono.MHex.Data;
>>> using Mono.MHex.Rendering;
>>> ........
>>> ................
>>>
>>> HexEditor he = new HexEditor();
>>> HexEditor.HexEditorData.Buffer = ArrayBuffer.Load("filename.ext");
>>> he.show();
>>>
>>> the hex editor widget is displayed correctly with the content from the file
>>>
>>> if instead i use the other overload for the Load method that accepts a
>>> stream like this:
>>>
>>> byte[] mybytearray = new byte[10]
>>> MemoryStream memstream = new MemoryStream();
>>> memstream.write(mybytearray, 0 mybytearray.Lenght);
>>>
>>> HexEditor he = new HexEditor();
>>> HexEditor.HexEditorData.Buffer = ArrayBuffer.Load(memstream);
>>> he.show();
>>>
>>> the widget is showed up, it looks like it's containing data couse its
>>> lenght is right according to the size of the stream
>>> but it's all filled with 00 instead of the stream data.
>>>
>>> am i doing something wrong?
>>>
>>> Thanks again for your support
>>> Best regards
>>> Francesco.
>>> _______________________________________________
>>> Monodevelop-list mailing list
>>> Monodevelop-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>>>
>>>
>
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>



-- 
Tom Spink


More information about the Monodevelop-list mailing list