0

I need to make a BitMap of the values stored in a dictionary. I've never really worked with graphics stuff so I have no idea.

public struct OrderKilled
{

    public Char[] TimeStamp;

    public Char[] FLAG_MSG;

    public Char[] Symbol;

    public Char[] OrderID;


    public static OrderKilled FromArray(byte[] bytes, int index)
    {
        using (var reader = new BinaryReader(new MemoryStream(bytes, index, 28)))
        {
            var s = default(OrderKilled);

            s.TimeStamp = reader.ReadChars(8);
            s.ITCH_MSG = reader.ReadChars(1);
            s.Symbol = reader.ReadChars(10);
            s.OrderID = reader.ReadChars(9);

            return s;
        }



    }


}


    private Dictionary<string, OrderKilled> OrdKilledDB = new Dictionary<string, OrderKilled>();

I'd like to convert the values of the dictionary to a bitmap. I'm not sure how this can be accomplished.

Thanks Guys

Valmorgal
  • 109
  • 9
  • I think that we need to first have any idea of what your fields mean. – Jashaszun Jun 13 '16 at 23:29
  • @Jashaszun They are all strings from a tcp stream being processed by a different thread. – Valmorgal Jun 13 '16 at 23:34
  • Never, Never take a bit map a convert it to a string. Always use instead byte[] arrays. – jdweng Jun 13 '16 at 23:42
  • @jdweng I've heard as much, but the TCP Stream isn't a bitmap it's just straight up text. – Valmorgal Jun 13 '16 at 23:43
  • A string consists of characters which is two bytes. Taking a binary image and putting into a string really messes things up. Because in some cases one byte gets put into a character (a zero is but into the 2nd byte of character) and in other cases two bytes gets put into a character. Then when the string is converted back to bytes there are extra zeroes that end up in the binary data. Depending on the encoding that is uses some data will be filtered or converted. TCP isn't text, it is a byte array. Bitmaps are not text. – jdweng Jun 13 '16 at 23:54
  • @jdweng Just to clear it up there is NO binary image in the TCP stream or anywhere else. I understand TCP isn't text, and that Bitmaps aren't text. Right now what I end up with in my Struct is Character arrays which I then create a string out of. I'd like a bitmap of the fields as string for the entire Dictionary's values. – Valmorgal Jun 14 '16 at 00:02
  • 1
    You can't use character arrays. Change to byte[]. Converting to strings and/or characters will corrupt the binary bit maps. Your dictionary is defined as Dictionary. What string are you using for the key? You will need to make your values a single string then use code on following posting : http://stackoverflow.com/questions/2070365/how-to-generate-an-image-from-text-on-fly-at-runtime – jdweng Jun 14 '16 at 08:33
  • @jdweng Thanks for the info...I'll keep working at it and use the link you gave me. Thanks again. – Valmorgal Jun 14 '16 at 20:24

0 Answers0