Exemplo n.º 1
0
        protected override void DealWithStringBuilder(StringBuilder sb, byte[] buffer)
        {
            sb.Append($"String sData =\"{ByteExtensions.BytesToString(buffer)}\";");
            sb.AppendLine();
            sb.Append($"String sDataHex =\"{ByteExtensions.BytesToHexString(buffer)}\";");
            sb.AppendLine();
            sb.AppendLine();
            sb.Append("byte rawData[] = {");
            sb.AppendLine();
            sb.Append("\t");

            var i = 0;

            foreach (byte b in buffer)
            {
                i++;
                sb.Append("(byte)");
                if (i == 6)
                {
                    i = 0;
                    sb.AppendLine();
                    sb.Append("\t");
                }
            }

            sb.AppendLine();
            sb.Append("};");
        }
Exemplo n.º 2
0
 protected override void DealWithStringBuilder(StringBuilder sb, byte[] buffer)
 {
     sb.Append($"char sData[] =\"{ByteExtensions.BytesToString(buffer)}\";");
     sb.AppendLine();
     sb.Append($"char sDataHex[] =\"{ByteExtensions.BytesToHexString(buffer)}\";");
     sb.AppendLine();
     sb.AppendLine();
     sb.Append($"unsigned char rawData[{buffer.Length}]{{ ");
     sb.AppendLine();
     sb.Append("\t");
 }
Exemplo n.º 3
0
 protected override void DealWithStringBuilder(StringBuilder sb, byte[] buffer)
 {
     sb.Append($"let sData = @\"{ByteExtensions.BytesToString(buffer)}\";");
     sb.AppendLine();
     sb.Append($"let sDataHex = @\"{ByteExtensions.BytesToHexString(buffer)}\";");
     sb.AppendLine();
     sb.AppendLine();
     sb.Append("let bytes = [|");
     sb.AppendLine();
     sb.Append("    ");
 }
Exemplo n.º 4
0
 protected override void DealWithStringBuilder(StringBuilder sb, byte[] buffer)
 {
     sb.Append($"string sData =\"{ByteExtensions.BytesToString(buffer)}\";");
     sb.AppendLine();
     sb.Append($"string sDataHex =\"{ByteExtensions.BytesToHexString(buffer)}\";");
     sb.AppendLine();
     sb.AppendLine();
     sb.Append("byte[] rawData = {");
     sb.AppendLine();
     sb.Append("\t");
 }
Exemplo n.º 5
0
 protected override void DealWithStringBuilder(StringBuilder sb, byte[] buffer)
 {
     sb.Append($"Dim sData as String =\"{ByteExtensions.BytesToString(buffer)}\";");
     sb.AppendLine();
     sb.Append($"Dim sDataHex as String =\"{ByteExtensions.BytesToHexString(buffer)}\";");
     sb.AppendLine();
     sb.AppendLine();
     sb.Append("Dim rawData As Byte() = { _");
     sb.AppendLine();
     sb.Append("\t");
 }
        public void BytesToString_Exception_value_Null()
        {
            byte[] value = null;

            Assert.Throws <ArgumentNullException>(() => ByteExtensions.BytesToString(value));
        }