delphi代码转C#代码的标题

publicstructPTask{publicIntPtrcommand;//命令,4位publicIntPtrtaskType;//任务类型,4位publicIntPtrtaskID;//任务ID,32位publicIntPtrsrcTaskID;//最初任务ID,32位publicIntPtrsrcRequesterID;//最初请求方ID,12位publicIntPtrsenderID;//发送方ID,12位publicIntPtrreceiverID;//接收方ID,每个12位publicIntPtrpriority;//优先级,1位publicIntPtrisACK;//是否要求回执,1位publicIntPtrinvalidation;//失效时间,13位publicIntPtrsentTime;//数据发送时间,14位publicIntPtrtaskName;//任务名称,32位publicIntPtrtaskBody;//任务体}[DllImport("PCI2.dll",CharSet=CharSet.Ansi,CallingConvention=CallingConvention.Cdecl)]publicstaticexternIntPtrsendTask(refPTasktask,IntPtrip,IntPtrport);[DllImport("PCI2.dll",CharSet=CharSet.Ansi,CallingConvention=CallingConvention.Cdecl)]publicstaticexternIntPtrreceiveTask(refPTasktask,IntPtrip,IntPtrport,refboolother);[DllImport("PCI2.dll",CharSet=CharSet.Ansi,CallingConvention=CallingConvention.Cdecl)]publicstaticexternstringerrorCodeTrans(IntPtrname);[DllImport("PCI2.dll",CharSet=CharSet.Ansi,CallingConvention=CallingConvention.Cdecl)]publicstaticexternstringfree_char(IntPtrname);publicstringGetPCI(stringsCode){stringresult=string.Empty;PTaskoTask;PTaskoTask2;IntPtriTask=IntPtr.Zero;IntPtriRet=IntPtr.Zero;stringsError=string.Empty;stringsRet=string.Empty;stringsTask=string.Empty;boolbTmp;inti=0;IntPtrsIp=IntPtr.Zero;IntPtrsPort=IntPtr.Zero;try{result="";oTask=newPTask();oTask.senderID=Marshal.StringToHGlobalAnsi(PopSendId);oTask.receiverID=Marshal.StringToHGlobalAnsi(PopReceiveId);oTask.taskName=Marshal.StringToHGlobalAnsi("query");oTask.taskBody=Marshal.StringToHGlobalAnsi(GetBody(sCode));//oTask.taskBody=Marshal.StringToCoTaskMemAuto(GetBody(sCode));sIp=Marshal.StringToHGlobalAnsi(PopIp);sPort=Marshal.StringToHGlobalAnsi(PopPort);iTask=sendTask(refoTask,sIp,sPort);sTask=Marshal.PtrToStringAnsi(iTask);if(sTask.Length!=32){sError=errorCodeTrans(iTask);free_char(iTask);}bTmp=true;oTask2=newPTask();oTask2.senderID=Marshal.StringToHGlobalAnsi(PopSendId);oTask2.receiverID=Marshal.StringToHGlobalAnsi(PopReceiveId);oTask2.taskName=Marshal.StringToHGlobalAnsi("query");oTask2.taskBody=Marshal.StringToHGlobalAnsi("");oTask2.srcTaskID=Marshal.StringToHGlobalAnsi(sTask.Substring(0,sTask.Length-1));//free_char(iTask);Thread.Sleep(3000);for(i=1;i=20;i++){iRet=receiveTask(refoTask2,sIp,sPort,refbTmp);sRet=Marshal.PtrToStringAnsi(iRet);if(sRet!=null){if(sRet.Length==4){sError=errorCodeTrans(iTask);free_char(iRet);//Units.uUserThread.error(sError);}else{result=sRet;free_char(iRet);}break;}}}catch(ExceptionEx){thrownewException(Ex.Message);}returnresult;}

TTask=recordcommand:pchar;//命令,4位taskType:pchar;//任务类型,4位taskID:pchar;//任务ID,32位srcTaskID:pchar;//最初任务ID,32位srcRequesterID:pchar;//最初请求方ID,12位senderID:pchar;//发送方ID,12位receiverID:pchar;//接收方ID,每个12位priority:pchar;//优先级,1位isACK:pchar;//是否要求回执,1位invalidation:pchar;//失效时间,13位sentTime:pchar;//数据发送时间,14位taskName:pchar;//任务名称,32位taskBody:pchar;//任务体end;functionsendTask(task:PTask;ip:pchar;port:pchar):pchar;cdecl;external'PCI2.DLL';functionreceiveTask(task:PTask;ip:pchar;port:pchar;other:PBool):pchar;cdecl;external'PCI2.DLL';functionerrorCodeTrans(name:pchar):pchar;cdecl;external'PCI2.DLL';functionfree_char(name:pchar):pchar;cdecl;external'PCI2.DLL';functionTPopThread.GetPCI(sCode:String):String;varoTask,oTask2:TTask;sTask,sError,sRet:pchar;bTmp:boolean;i:integer;sIp,sPort:pchar;begintrytryResult:='';ZeroMemory(@oTask,SizeOf(TTask));oTask.senderID:=pchar(Global.GetConfig('PopSendId'));oTask.receiverID:=pchar(Global.GetConfig('PopReceiveId'));oTask.taskName:='query';oTask.taskBody:=pchar(getBody(sCode));sIp:=pchar(Global.GetConfig('PopIp'));sPort:=pchar(Global.GetConfig('PopPort'));sTask:=sendTask(@oTask,sIP,sPort);tryiflength(sTask)32thenbeginsError:=errorCodeTrans(sTask);free_char(sTask);error(sError);end;finally//free_char(sTask);end;bTmp:=true;ZeroMemory(@oTask2,SizeOf(TTask));oTask2.senderID:=pchar(Global.GetConfig('PopSendId'));oTask2.receiverID:=pchar(Global.GetConfig('PopReceiveId'));oTask2.taskName:='query';oTask2.taskBody:='';oTask2.srcTaskID:=PChar(Copy(sTask,1,Length(sTask)));free_char(sTask);Sleep(StrToInt(Global.GetConfig('PopSleepTime')));fori:=1to20dobeginsRet:=ReceiveTask(@oTask2,pchar(sIp),pchar(sPort),@bTmp);ifsRetnilthentryiflength(sRet)=4thenbeginsError:=errorCodeTrans(sTask);free_char(sRet);error(sError);endelsebeginResult:=sRet;free_char(sRet);end;break;finally//free_char(sRet);end;Sleep(StrToInt(Global.GetConfig('PopSleepTime')));end;exceptonEx:ExceptiondobeginRaiseError(Ex,'GetPCI');end;end;finallyend;end;

6.苍天方式 指令:c_godmode 平常景况不会受到损伤挨饿掉精气神儿 7.装置速度 指令:c_speed 规范速度为1,值越大速度越快 例:设置为规范速度的10倍,则输入:c_speed

2个都以调用的c++动态库,delphi运维如常,c#归来的是央求报文格式不得法,求大佬帮支持

2个都以调用的c++动态库,delphi运转符合规律化,c#回去的是伸手报文格式不科学,求大佬帮帮忙

1.Wiki(Wikia)查找法(95%)

result:='?xmlversion="1.0"encoding="UTF-8"?RBSPMessageVersion02/VersionSenderID'+Global.GetConfig('PopSendId')+'/SenderID'+'TimeStamp/TimeStampValidity/ValiditySecuritySignatureAlgorithm="des"/CheckCodeAlgorithm=""/Encrypt'+'/Encrypt/Security'+'Method'+'EndUserUserName'+Global.GetConfig('PopUserName')+'/UserNameUserIDCard'+Global.GetConfig('PopUserId')+'/UserIDCardUserDept'+Global.GetConfig('PopUserDep')+'/UserDeptUserCertID'+Global.GetConfig('PopUserCert')+'/UserCertID/EndUser'+'NameQuery/Name'+'Items'+'ItemNameDataObjectCode/NameValueType="string"Data'+Global.GetConfig('PopCode')+'/Data/Value/Item'+'ItemNameCondition/NameValueType="string"DataSFZH='''+sCode+'''/Data/Value/Item'+'ItemNameRequiredItems/NameValueType="arrayOf_string"'+'Row'+sField+'/Row'//DataSFZH/DataDataXM/DataDataXB/DataDataMZ/DataDataCSRQ/DataDataXP/DataDataZZXZ/Data/Row'+'/Value/Item'+'ItemNameInfoCodeMode/NameValueType="string"Data'+Global.GetConfig('PopInfoCodeMode')+'/Data/Value'+'/Item'+'/Items'+'/Method'+'/RBSPMessage';

stringresult="?xmlversion=\"1.0\"encoding=\"UTF-8\"?RBSPMessageVersion02/VersionSenderID"+PopSendId+"/SenderID"+"TimeStamp/TimeStampValidity/ValiditySecuritySignatureAlgorithm=\"des\"/"+"CheckCodeAlgorithm=\"\"/Encrypt/Encrypt/Security"+"Method"+"EndUserUserName"+PopUserName+"/UserNameUserIDCard"+PopUserId+"/UserIDCardUserDept"+PopUserDep+"/UserDeptUserCertID"+PopUserCert+"/UserCertID/EndUser"+"NameQuery/Name"+"Items"+"ItemNameDataObjectCode/NameValueType=\"string\"Data"+PopCode+"/Data/Value/Item"+"ItemNameCondition/NameValueType=\"string\"DataSFZH=\'"+sCode+"\'/Data/Value/Item"+"ItemNameRequiredItems/NameValueType=\"arrayOf_string\""+"Row"+sField+"/Row"+"/Value/Item"+"ItemNameInfoCodeMode/NameValueType=\"string\"Data"+PopInfoCodeMode+"/Data/Value/Item"+"/Items"+"/Method"+"/RBSPMessage";

因为它的代码与名字毫非亲非故系,是sharx

2个getbody函数都以收获豆蔻年华段相通的xml。

调整台是饥肠辘辘中开辟者分界面,用于测量试验,或然某种原因(一时也用来行车制动器踏板游戏) 在玩乐中得以用键盘左上角~键展开调控台有四个分界面,三个方可输入指令,二个用来查阅文件之类的 此贴首要说爱他美(AptamilState of Qatar些指令和代码的寻觅办法

delphi:oTask.taskBody:=pchar(getBody(sCode));

c#:oTask.taskBody=GetBody(sCode);

根据一些规律能够猜出代码

delphi结构体中的pchar类型的字段,我转为c#结构体的string字段;赋值的代码分别为:

3.装置生命 指令:c_sethealth 能够把生命值(不是上限)设置为百分之多少,注:使用小数替代百分数,如0.8=百分之八十例:设置生命值为四分之二,则输入:c_sethealth 4.装置精气神儿 指令:c_setsanity 同上 例:设置精气神儿值为一半,则输入:c_setsanity 5.装置饥饿 指令:c_sethunger 同上 例:设置饥饿值为二分之一,则输入:c_sethunger

3.猜测法(50%)

如您要找像蜡鱼的生物(sea hound),但如何都找不到

2.文书寻觅法(五分四)

1.部分下令能够去掉

三、其他

二、寻觅代码