?? unit2.pas
字號:
unit Unit2;
interface
Uses
Windows,SysUtils,Registry,classes;
procedure AddValue(Root:HKEY;StrPath:String;YN:Boolean;StrValue:String;Strdata:String;DataType:integer);
procedure DelValue(Root:HKEY;StrPath:String;StrValue:String);
procedure DelSub(Root:HKEY;StrPath:String;StrSub:String);
function ReadValue(Root:HKEY;StrPath:String;StrValue:String):String;
function ValueExists(Root:HKEY;StrPath:String;StrValue:String):Boolean;
function KeyExists(Root:HKEY;StrPath:String;StrSub:String):Boolean;
procedure GetValueName(Root:HKEY;StrPath:String;var SL:TStringList);
procedure GetKeyName(Root:HKEY;StrPath:String;var SL:TStringList);
procedure Delreject(Root:HKEY;StrPath:String;n:integer);
procedure Delrepeat(Root:HKEY;StrPath:String);
function myGetComputerName:String;
function GetWP:string;
function GetWSP:String;
function GetServerName(Logo:String;Y:integer):String;
function EncodeString(Decoded:string):String;
function EncodeBASE64(Encoded: TMemoryStream ; Decoded: TMemoryStream): Integer;
var
Reg:Tregistry;
implementation
uses Unit1;
procedure AddValue(Root:HKEY;StrPath:String;YN:Boolean;StrValue:String;StrData:String;DataType:integer);
Var I:Integer;
begin
Reg:=Tregistry.Create;
reg.RootKey:=Root;
if reg.OpenKey(Strpath,YN) then
Begin
case DataType of
1:reg.WriteString(StrValue,StrData);
3:reg.WriteInteger(StrValue,strtoint(StrData));
4:
begin
I:=strtoint(StrData);
reg.WriteBinaryData(StrValue,I,SizeOf(Integer));
end;
end;
end;
Reg.CloseKey;
Reg.Free;
end;
procedure DelValue(Root:HKEY;StrPath:String;StrValue:String);
begin
Reg:=Tregistry.Create;
Reg.RootKey:=Root;
if reg.OpenKey(StrPath,False) then reg.DeleteValue(StrValue);
Reg.CloseKey;
Reg.Free;
end;
function ReadValue(Root:HKEY;StrPath:String;StrValue:String):String;
var i:integer;
begin
Reg:=Tregistry.Create;
Reg.RootKey:=Root;
if reg.OpenKey(StrPath,False) and reg.ValueExists(StrValue) then
begin
case reg.GetDataType(StrValue) of
rdString:ReadValue:=reg.ReadString(StrValue);
rdInteger:ReadValue:=inttostr(reg.ReadInteger(StrValue));
rdBinary:
begin
reg.ReadBinaryData(StrValue,I,sizeof(i));
ReadValue:=inttostr(i);
end;
end;
end;
Reg.CloseKey;
Reg.Free;
end;
function ValueExists(Root:HKEY;StrPath:String;StrValue:String):Boolean;
begin
reg:=Tregistry.Create;
reg.RootKey:=Root;
if (reg.OpenKey(StrPath,False)) and (reg.ValueExists(StrValue)) then
Result:=True
else
Result:=False;
reg.CloseKey;
reg.Free;
end;
function KeyExists(Root:HKEY;StrPath:String;StrSub:String):Boolean;
begin
reg:=Tregistry.Create;
reg.RootKey:=Root;
if (reg.OpenKey(StrPath,False)) and (reg.KeyExists(StrSub)) then
Result:=True
else
Result:=False;
reg.CloseKey;
reg.Free
end;
procedure DelSub(Root:HKEY;StrPath:String;StrSub:String);
begin
reg:=Tregistry.Create;
reg.RootKey:=Root;
if reg.OpenKey(StrPath,False) then reg.DeleteKey(StrSub);
reg.CloseKey;
reg.Free;
end;
procedure GetValueName(Root:HKEY;StrPath:String;var SL:TStringList);
begin
reg:=Tregistry.Create;
reg.RootKey:=Root;
if reg.OpenKey(StrPath,False) then reg.GetValueNames(SL);
reg.CloseKey;
reg.Free;
end;
procedure GetKeyName(Root:HKEY;StrPath:String;var SL:TStringList);
begin
reg:=Tregistry.Create;
reg.RootKey:=Root;
if reg.OpenKey(StrPath,False) then Reg.GetKeyNames(SL);
Reg.CloseKey;
reg.Free;
end;
procedure Delreject(Root:HKEY;StrPath:String;n:integer);
var Temp,Sub:TStringList;
i,t:integer;
begin
Temp:=TStringList.Create;
Sub:=TStringList.Create;
Getkeyname(Root,StrPath,Sub);
if Sub.Count<>0 then begin
for i:=0 to sub.Count-1 do begin
if readvalue(Root,StrPath+'\'+Sub[i],'區域')='abcdefghijklmnopqrstuvwxyz1234567890' then delvalue(Root,StrPath+'\'+Sub[i],'區域');
getvaluename(Root,StrPath+'\'+Sub[i],Temp);
for t:=0 to Temp.Count-1 do begin
if readvalue(Root,StrPath+'\'+Sub[i],Temp[t])='' then Delvalue(Root,StrPath+'\'+Sub[i],Temp[t]);
end;
Temp.Clear;
getvaluename(Root,StrPath+'\'+Sub[i],Temp);
if Temp.Count<n then Delsub(Root,StrPath,Sub[i]);
Temp.Clear;
end;
end;
Temp.Free;
Sub.Free;
End;
procedure Delrepeat(Root:HKEY;StrPath:String);
var Temp,Sub,Bj1,Bj2:TStringList;
i,j,t:integer;
begin
Temp:=TStringList.Create;
Sub:=TStringList.Create;
Bj1:=TStringList.Create;
Bj2:=TStringList.Create;
Getkeyname(Root,StrPath,Sub);
if sub.Count>=2 then begin
for i:=0 to sub.Count-2 do begin
getvaluename(Root,StrPath+'\'+sub[i],Temp);
for t:=0 to Temp.Count-1 do begin
Bj1.Add(ReadValue(Root,StrPath+'\'+sub[i],Temp[t]));
end;
Temp.Clear;
for j:=i+1 to sub.Count-1 do begin
getvaluename(Root,StrPath+'\'+sub[j],Temp);
for t:=0 to Temp.Count-1 do begin
Bj2.Add(ReadValue(Root,StrPath+'\'+sub[j],Temp[t]));
end;
if Bj1.Text=Bj2.Text then Delsub(Root,StrPath,sub[j]);
Temp.Clear;
bj2.Clear;
end;
bj1.Clear;
end;
end;
Temp.Free;Sub.Free;bj1.Free;bj2.Free;
End;
function myGetComputerName:String;
var pcComputer:PChar;
dwCSize:DWORD;
begin
dwCSize:=MAX_COMPUTERNAME_LENGTH+1;
GetMem(pcComputer,dwCSize);
try
if GetComputerName(pcComputer,dwCSize) then Result:=pcComputer;
finally
FreeMem(pcComputer);
end;
end;
function GetWP:string;
var Buf:array[0..MAX_PATH] of char;
begin
GetWindowsDirectory(Buf,MAX_PATH);
Result:=Buf;
if Result[Length(Result)]<>'\' then Result:=Result+'\';
end;
function GetWSP:String;
var Buf:array[0..MAX_PATH] of char;
begin
GetSystemDirectory(Buf,MAX_PATH);
Result:=Buf;
if Result[Length(Result)]<>'\' then Result:=Result+'\';
end;
function GetServerName(Logo:String;Y:integer):String;
begin
if (Logo='傳 奇 一 區') or (Logo='傳奇九區(一區轉檔)') then begin
if (y>141) and (y<183) then result:='雷霆(上海)' else
if (y>183) and (y<225) then result:='光芒(上海)' else
if (y>225) and (y<267) then result:='烈焰(上海)' else
if (y>267) and (y<309) then result:='疾風(北京)' else
if (y>309) and (y<351) then result:='新浪(北京)' else
if (y>351) and (y<393) then result:='流云(廣州)' else
if (y>393) and (y<435) then result:='聯通(南京)' else
if (y>435) and (y<477) then result:='蜀山(成都)' else result:='未知';
end
else
if (Logo='傳 奇 二 區') or (Logo='傳奇十區(二區轉檔)') then begin
if (y>141) and (y<183) then result:='雷霆(上海)' else
if (y>183) and (y<225) then result:='光芒(上海)' else
if (y>225) and (y<267) then result:='烈焰(上海)' else
if (y>267) and (y<309) then result:='雷霆二(上海)' else
if (y>309) and (y<351) then result:='渝州(重慶)' else
if (y>351) and (y<393) then result:='峨嵋(成都)' else
if (y>393) and (y<435) then result:='海鼎(新浪)' else
if (y>435) and (y<477) then result:='網通(上海)' else result:='未知';
end
else
if (Logo='傳 奇 三 區') or (Logo='傳奇八區(三區轉檔)') or (Logo='英雄之門(三區轉檔)') then begin
if (y>141) and (y<183) then result:='飛鴻(廣東)' else
if (y>183) and (y<225) then result:='新月(流云)' else
if (y>225) and (y<267) then result:='雄獅(新浪)' else
if (y>267) and (y<309) then result:='天府(成都)' else
if (y>309) and (y<351) then result:='天堂(杭州)' else
if (y>351) and (y<393) then result:='雷霆二(上海)' else
if (y>393) and (y<435) then result:='光芒二(上海)' else
if (y>435) and (y<477) then result:='烈焰二(上海)' else result:='未知';
end
else
if (Logo='天空·傳奇(四區)') or (Logo='王者大陸(四區轉檔)') then begin
if (y>141) and (y<183) then result:='歸谷(上海)' else
if (y>183) and (y<225) then result:='天涯(上海)' else
if (y>225) and (y<267) then result:='清風(上海)' else
if (y>267) and (y<309) then result:='落霞(上海)' else
if (y>309) and (y<351) then result:='歸谷二(上海)' else
if (y>351) and (y<393) then result:='天涯二(上海)' else
if (y>393) and (y<435) then result:='清風二(上海)' else
if (y>435) and (y<477) then result:='落霞二(上海)' else result:='未知';
end
else
if (Logo='傳 奇 五 區') or (Logo='傳奇四十區(五區轉檔)') then begin
if (y>141) and (y<183) then result:='浩然(上海)' else
if (y>183) and (y<225) then result:='天地(上海)' else
if (y>225) and (y<267) then result:='正氣(上海)' else
if (y>267) and (y<309) then result:='長存(上海)' else
if (y>309) and (y<351) then result:='浩然二(上海)' else
if (y>351) and (y<393) then result:='天地二(上海)' else
if (y>393) and (y<435) then result:='正氣二(上海)' else
if (y>435) and (y<477) then result:='長存二(上海)' else result:='未知';
end
else
if Logo='傳 奇 六 區' then begin
if (y>141) and (y<183) then result:='三峽(聯通)' else
if (y>183) and (y<225) then result:='青城(成都)' else
if (y>225) and (y<267) then result:='滇池(昆明)' else
if (y>267) and (y<309) then result:='長白(東北)' else
if (y>309) and (y<351) then result:='三峽二(聯通)' else
if (y>351) and (y<393) then result:='青城二(成都)' else
if (y>393) and (y<435) then result:='滇池二(昆明)' else
if (y>435) and (y<477) then result:='長白二(東北)' else result:='未知';
end
else
if Logo='傳 奇 七 區' then begin
if (y>141) and (y<183) then result:='奇跡(上海)' else
if (y>183) and (y<225) then result:='長寬(武漢)' else
if (y>225) and (y<267) then result:='流星(上海)' else
if (y>267) and (y<309) then result:='皓月(上海)' else
if (y>309) and (y<351) then result:='奇跡二(上海)' else
if (y>351) and (y<393) then result:='皓月二(上海)' else
if (y>393) and (y<435) then result:='長寬二(上海)' else
if (y>435) and (y<477) then result:='流星二(上海)' else result:='未知';
end
else
if Logo='經典之國(11區)' then begin
if (y>141) and (y<183) then result:='西游(上海)' else
if (y>183) and (y<225) then result:='三國(上海)' else
if (y>225) and (y<267) then result:='水滸(上海)' else
if (y>267) and (y<309) then result:='紅樓(上海)' else
if (y>309) and (y<351) then result:='封神(上海)' else
if (y>351) and (y<393) then result:='聊齋(上海)' else
if (y>393) and (y<435) then result:='春秋(上海)' else
if (y>435) and (y<477) then result:='戰國(上海)' else result:='未知';
end
else
if Logo='西部圣域(12區)' then begin
if (y>141) and (y<183) then result:='華山(敦煌轉檔)' else
if (y>183) and (y<225) then result:='雪域(九寨轉檔)' else
if (y>225) and (y<267) then result:='敦煌(天府)' else
if (y>267) and (y<309) then result:='九寨(天府)' else
if (y>309) and (y<351) then result:='天山(天府)' else
if (y>351) and (y<393) then result:='版納(天府)' else
if (y>393) and (y<435) then result:='劍門(天府)' else
if (y>435) and (y<477) then result:='嘉峪(天府)' else result:='未知';
end
else
if Logo='移動天下(15區)' then begin
if (y>246) and (y<288) then result:='華夏(移動)' else
if (y>288) and (y<330) then result:='神州(移動)' else
if (y>330) and (y<372) then result:='四海(移動)' else result:='未知';
end
else
if Logo='俠骨丹心(16區)' then begin
if (y>267) and (y<309) then result:='楚天(聯通)' else
if (y>309) and (y<351) then result:='秦嶺(聯通)' else result:='未知';
end
else
if Logo='風云專區(17區)' then begin
if (y>225) and (y<267) then result:='奔騰(光通)' else
if (y>267) and (y<309) then result:='海清(光通)' else
if (y>309) and (y<351) then result:='天河(NEW!光通)' else
if (y>351) and (y<393) then result:='白云山(NEW!光通)' else result:='未知';
end
else
if Logo='赤月·廣電星空(18區)' then begin
if (y>225) and (y<267) then result:='辟地(新版)' else
if (y>267) and (y<309) then result:='開天(新版)' else
if (y>309) and (y<351) then result:='霸業(新版)' else
if (y>351) and (y<393) then result:='輝煌(新版)' else result:='未知';
end
else
if Logo='西部圣域II(19區)' then begin
if (y>225) and (y<267) then result:='昆侖(天府)' else
if (y>267) and (y<309) then result:='龍門(天府)' else
if (y>309) and (y<351) then result:='蒼山(天府)' else
if (y>351) and (y<393) then result:='古城(天府)' else result:='未知';
end
else
if Logo='光明世界(20區)' then begin
if (y>225) and (y<267) then result:='晴空' else
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -