Exemple #1
0
 public void LoadStream(byte[] b)
 {
     byte[] col_byte = new byte[2];
     foreach (var k in labelsToMemOffsets.Keys)
     {
         int offset = labelsToMemOffsets[k][0];
         col_byte[0] = b[offset];
         col_byte[1] = b[offset + 1];
         Color col = PaletteHelper.ByteToColor(col_byte);
         labelsToColors[k] = col;
     }
 }
Exemple #2
0
        // function that takes byte stream, dictionary, and list of labels
        // outputs an array of colors for those labels
        public static Color[] ColorsFromLabelsAndStream(byte[] b,
                                                        Dictionary <string, List <int> > offsets, List <string> labels)
        {
            List <Color> colors = new List <Color>();

            foreach (string label in labels)
            {
                int    position = offsets[label][0];
                byte[] colbyte  = new byte[2];
                colbyte[0] = b[position];
                colbyte[1] = b[position + 1];
                Color col = PaletteHelper.ByteToColor(colbyte);
                colors.Add(col);
            }
            return(colors.ToArray());
        }