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

Mike Krüger mkrueger at novell.com
Wed Sep 1 09:56:35 EDT 2010


  Hi

That's because it inherits from the mono texteditor - the underlying 
component doesn't update - it's up to the actions to decide what & when 
to update.

There are update methods for updating parts of the hex editor - btw. 
using it as a hex viewer should be very simple - just strip the things 
that change the buffer :)

Regards
Mike
> Hi Tom,
> i've managed to make it work,
> it looks like the Write() method on the memory stream screws things up
> just passing the array as an argument to the constructor made everything
> to work.
>
> at least now i can show up data, but i'll have to play with the hex
> editor a lot more, even if i only need it as a hex viewer, so i'm not
> going to use all the features,
> i've noticed that if i change the content of the buffer, the content
> shown doesn't change till i select part of it or scroll the scrollwindow
> container up/down.
>
> i was also looking forward to have a fixed size for the columns couse
> expanding the window size causes the number of column to
> increase/decrease to fit the size of the window, and it's not good imho,
> i hope there is an option for this :)
>
> also preventing the editing would be cool, but well.. i can't have it
> all.. it would be too much cool :)
>
> by the way, thank you very much for the precious help you provided me, i
> hope i'll be able to pay you back in the near future
>
> Best regards
> Rampage.
>
> Tom Spink ha scritto:
>> 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
>>>
>>>
>>
>>
>>
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list



More information about the Monodevelop-list mailing list