internal static IDelegateCommand CreateCopyToCopyHexToCBoardCommand(IHexDataContext hexDataContext) { var copyHexToCBoardCommand = CommandFactory.CreateDelegateCommand( () => { if (hexDataContext.SelectionStart == -1 || hexDataContext.SelectionStart == -1) //若需剪切数据大于4GB { return; } if (hexDataContext.SelectionLength - hexDataContext.SelectionStart > MaxCopyToClipBoardSize) { MsgBoxService.Current?.Show(LanguageService.Current?.FindResourceString(Constants.MsgText_TooLargeCopySize)); return; } try { var buffer = hexDataContext.GetSelectionData(); ClipBoardService.SetText(ByteExtensions.BytesToHexString(buffer)); } catch (Exception ex) { LoggerService.WriteCallerLine(ex.Message); MsgBoxService.Current?.Show($"{ex.Message}"); } }); return(copyHexToCBoardCommand); }
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("};"); }
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"); }
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(" "); }
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"); }
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"); }