- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
while (s != null)
{
s = fs.ReadLine();
//arr line example <rect x="0" y="0" rgba(92,41,235,0.9921568627451
String[] arr = s.Split('(');
arr = arr[1].Split(',');
int fourPart = (int)(float.Parse(arr[3].Replace('.',',')) * 0xFF);
var binaryFour = Convert.ToString(fourPart, 2);
while(binaryFour.Length < 8)
{
binaryFour = "0" + binaryFour;
}
int threePart = int.Parse(arr[2]);
var binaryThree = Convert.ToString(threePart, 2);
while (binaryThree.Length < 8)
{
binaryThree = "0" + binaryThree;
}
int twoPart = int.Parse(arr[1]);
var binaryTwo = Convert.ToString(twoPart, 2);
while (binaryTwo.Length < 8)
{
binaryTwo = "0" + binaryTwo;
}
int firstPart = int.Parse(arr[0]);
var binaryfirst = Convert.ToString(firstPart, 2);
number = Convert.ToInt32((binaryfirst + binaryTwo + binaryThree + binaryFour),2);
Write("number", number.ToString());
}