_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › Bit瑚鍵

ろ襴渚 ろ
    public override void 0_ProcessInputRow(0Buffer Row)
    {
        /*
         * Add your code here
         */

        Row.onecnt = HexToBin(Row.hex).Replace("0", "").Length;

    }

    static string HexToBin(string hexadecimal)
    {
        string binary = string.Empty;

        for (int i = 0; i < hexadecimal.Length; i++)
        {
            switch (hexadecimal[i])
            {
                case '0': binary += "0000"; break;
                case '1': binary += "0001"; break;
                case '2': binary += "0010"; break;
                case '3': binary += "0011"; break;
                case '4': binary += "0100"; break;
                case '5': binary += "0101"; break;
                case '6': binary += "0110"; break;
                case '7': binary += "0111"; break;
                case '8': binary += "1000"; break;
                case '9': binary += "1001"; break;
                case 'A': binary += "1010"; break;
                case 'B': binary += "1011"; break;
                case 'C': binary += "1100"; break;
                case 'D': binary += "1101"; break;
                case 'E': binary += "1110"; break;
                case 'F': binary += "1111"; break;

                default:
                    break;
            }
        }

        //remove leading zero's
        binary = binary.Trim('0');
        return (binary);
    }
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-11-21 17:10:37Anonymous