求高手 Delphi 代码转 c#

cs_op 2010-06-09 10:02:52

//这是一个函数
function StrTOBcd(Str: string): string;
var
aa, n,i, Bytes: Byte;
Odd: boolean;
hex1,Hex: string;
begin
str := trim(str); //去空格和回车等特殊字符
str := stringreplace(str, ' ', '', [rfReplaceAll]);
Result := '';
Odd := Length(Str) mod 2 = 1;
Bytes := (Length(Str) + 1) div 2;
if Odd then Str := Str + '0';
for i := 0 to Bytes - 1 do
begin
Hex := Copy(Str, i * 2 + 1, 2);
//ShowMessage(chr(01));
Result := Result + chr(HexToInt(Hex));
end;
end;







//另一个
function BcdTOstr(ss: string): string;
var
i: integer;
s, s2: string;
begin
for i := 1 to length(ss) do
begin
s2 := ss[i];
s := s + BCD2Str(pchar(s2), 0, 2);
end;
result := s;
end;


function BCD2Str(P: PChar; Pos, Len: integer): string;
var
i: integer;
strResult: string;
cRead: Byte;
cReadH, cReadL: Byte;
bOdd: boolean;
begin
strResult := '';
if (Len mod 2) = 1 then
begin
Len := (Len + 1) div 2;
bOdd := true;
end else begin
Len := Len div 2;
bOdd := false;
end;
for i := 0 to Len - 1 do
begin
cRead := Ord(P[pos + i]);
cReadH := (cRead and $F0) shr 4;
strResult := strResult + IntToHex(cReadH, 1);
if (i = Len - 1) and bOdd then continue;
cReadL := cRead and $0F;
strResult := strResult + IntToHex(cReadL, 1);
end;
BCD2Str := strResult;
end;




...全文
68 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
banks1983 2010-06-10
  • 打赏
  • 举报
回复
关注学习
cs_op 2010-06-09
  • 打赏
  • 举报
回复
哦 我看见了

public static byte[] convert_BCD_To_Str(byte[] srcByteArray, int startPos, int maxSize)


public static byte[] convert_Str_BCD_Left(byte[] srcByteArray, int maxSize)

参数是什么意思啊
捷哥1999 2010-06-09
  • 打赏
  • 举报
回复
看看我写的吧!
这个帖子我答复的,3楼和4楼就是你要的!

http://topic.csdn.net/u/20100607/11/f8062634-6267-4bf8-b633-c5d85f160ff2.html
软件保护与破解始终在战斗中发展,本资源提供的软件保护程序为.net源代码。破解软件为reflector,收集了所有的插件,大部分为源代码 (软件保护源代码可是找了一年才找到,可是源代码啊,对研究软件保护技术太有帮助了,基本上保护措施都有了,可以参见www.pediy.com网站出的书,我改造了一下在自己产品中使用,对reflector进行了防护,改造的程序不放出也不卖,否则高手知道我怎么防护的就很容易写个reflector插件破解我产品了,大家可以拿代码研究自己改造,最好参考单海波等人写的《微软.net程序加密与解密》这本书,不是为他们书做广告,因为是2008年出版的,想买可能也买不到了,基本上把书里讲到的软件保护技术都实现了,如果不是源代码出自国外牛人,还真认为他们是一伙的) 软件保护支持特性: 1. Name Obfuscation 2.User Strings Encryption 3.Proxy for external/internal 4.constructors/methods 5.Adding Incorrect Metadata 6.Control Flow Obfuscation 7.Compress Output Assembly 反编译reflector软件插件列表: 1.CodeMetrics: Analyses .NET assemblies and shows design quality metrics. 2.Review: Allows editing and managing annotations during code reviews. 3.Diff: This add-in shows differences between two versions of the same assembly. 4.Pex: Use the Pex Wizard directly from Reflector (requires .NET 2.0) 5.Snippy: Snippy is a light weight snippet compiler integrated into .NET Reflector. 6.SilverlightLoader: Allows browsing the structure of a website and loading Silverlight assemblies. 7.FileDisassembler: This add-in can be used to dump the disassembler output to files for any Reflector supported language. 8.Reflexil: Allows to manipulate the IL of a loaded assembly, or inject VB.net/C# code, then write the changes to disk. 9.BamlViewer: Load BAML resources (WPF) and render in XAML format. 10.SilverlightBrowser: Loads and shows the files associated with a Silverlight website. 11.ComLoader: Lists COM components for browsing and converts them into managed interop assemblies. 12.SQL2005Browser: This add-in allows to browse .NET assemblies stored in SQL Server 2005 databases. 13.FileGenerator: This add-in can be used to dump the disassembler output to files for any Reflector supported language. 14.Deblector: This add-in allows to debug processes from within Reflector. 15.Doubler: A code generator for unit tests, stubs and wrappers. 17.Graph: This add-in draws assembly dependency graphs and IL graphs. Please read the install instructions here. 18.BizTalkDisassembler: Allows you to list all BizTalk artifacts contained in an assembly and extract them. 19. DependencyStructureMatrix: Allows you to create and browser dependency structure matrices. 20.CodeSearch: This add-in allows searching for strings and regular expressions in disassembled code. 21.RuleSetEditor: Editor for Windows Workflow Foundation rules. 22.AssemblyListEx:Register a file type association for predefined lists of assemblies to load into Reflector. 23.SequenceViz: This add-in draws sequence diagrams. 24.AutoDiagrammer: This add-in draws class diagrams. 25.Xmi4DotNet: Export an assembly to XMI/UML. 26.AssemblyCollectionSort: Sorts the current assembly list alphabetically. 27.Enums: Conversion of big flags and enum viewer. 28.PowerShellLanguage: Renders output as Windows PowerShell script. 29.DelphiLanguage: The Delphi view that is used inside .NET Reflector provided as a language add-in. 30.CppCliLanguage: This add-in extends Reflector with a C/CLI language rendering module. 31. ReflectionEmitLanguage: This add-in renders C# code necessary to create the given IL body. 32. TestDriven.net: This Visual Studio add-in can navigate to any code element inside Reflector with a single click. 33. Hawkeye: A tool that allows you to debug the UI tree of Windows Forms applications. 35. ClassView: Shows class definitions as plain text with color coding. 36. CodeModelViewer: This add-in shows the underlying code model objects for selected items.

111,092

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧