private void fileNameToColors(string filename, out Bgr bgr, out Hsv hsv)
{
//This is a filename:
//B146, G159, R136=Green - H123, S80, V178=Purple VERDICT=Purple.png
string[] parts = filename.Split(' ', '=');//, 'B', 'G', 'R', 'H', 'S', 'V'
/*
* With this splitting,
* parts[0] = B-value,
* parts[1] = G-value,
* parts[2] = R-value,
*
* parts[3] = H-value,
* parts[4] = S-value,
* parts[5] = V-value,
*/
try
{
string B = parts[0].Replace(',', ' ').Substring(1);
string G = parts[1].Replace(',', ' ').Substring(1);
string R = parts[2].Replace(',', ' ').Substring(1);
string H = parts[5].Replace(',', ' ').Substring(1);
string S = parts[6].Replace(',', ' ').Substring(1);
string V = parts[7].Replace(',', ' ').Substring(1);
int b = int.Parse(B);
int g = int.Parse(G);
int r = int.Parse(R);
int h = int.Parse(H);
int s = int.Parse(S);
int v = int.Parse(V);
bgr = new Bgr(b, g, r);
hsv = new Hsv(h, s, v);
}
catch (Exception)
{
bgr = new Bgr();
hsv = new Hsv();
}
}