Exp=x
ModuleFileName=Function_1.sru
@end
$PBExportHeader$@ytclass.sru
forward
global type @ytclass from nonvisualobject
end type
end forward

global type @ytclass from nonvisualobject
end type
global @ytclass @ytclass

type prototypes
//ڹȫⲿú
PUBLIC FUNCTION int ConnectServer(string severname,int pos) LIBRARY "ClientKeyDll.DLL" 
PUBLIC FUNCTION int DisconnectServer() LIBRARY "ClientKeyDll.DLL"
PUBLIC FUNCTION int FindPort_2 (int start,string filename,int pos,ref string keypath_1) LIBRARY "ClientKeyDll.DLL"
PUBLIC FUNCTION int Cal_2(string FileName, int start,int len,ref int ele1,ref int ele2,ref int  ele3,ref int  ele4,string InPath,int cycle) LIBRARY "ClientKeyDll.DLL" 	
PUBLIC FUNCTION int y_or (int p1,int p2) LIBRARY "ClientKeyDll.DLL"
PUBLIC FUNCTION int y_and (int p1,int p2) LIBRARY "ClientKeyDll.DLL"
PUBLIC FUNCTION int stoi_2 (string inchar,ref int yp1,ref int yp2) LIBRARY "ClientKeyDll.DLL" 
PUBLIC FUNCTION int itos_2 (int p1,int p2,ref string outchar) LIBRARY "ClientKeyDll.DLL" 	
PUBLIC FUNCTION int FindPort_4 (string filename,int pos,ref string HKey,ref string LKey,ref string keypath_1) LIBRARY "ClientKeyDll.DLL" 	
PUBLIC FUNCTION int CalculateEx_3(string FileName, int start,int len,ref int ele1,ref int ele2,ref int  ele3,ref int  ele4,string InPath,int cycle) LIBRARY "ClientKeyDll.DLL" 
PUBLIC FUNCTION int E_Ex_3(string HKey,string LKey,string FileName,string DestName,string InPath) LIBRARY "ClientKeyDll.DLL" 	
PUBLIC SUBROUTINE  AutoDisConnect  (Long timer , Boolean biao ) LIBRARY "ClientKeyDll.DLL"
end prototypes

type variables
long lasterror
string KeyPath;
//lasterrorĴKeyPathڵ豸·

end variables

forward prototypes
public function int ServerConnect(string server,int c_port)
public subroutine ini ()
public subroutine ini_3 (string HKey,string LKey)
public function long getlasterror ()
public function boolean checkkey ()
public function long yadd (  long a, long b )
public function Boolean yand ( Boolean a, Boolean b )
public function boolean Ycompare ( long yp1, long yp2, string exp )
public function boolean ycomparestring ( string s1, string s2, string exp)
public function long ydecrease (  long a, long b )
public function long ydivide (  long a, long b )
public function long ymultiply ( long a, long b )
public function Boolean yor ( Boolean a, Boolean b )
public function long ysetvalue ( long a )
public function string ystrcat ( string s1, string s2)
public function string ystrcpy (  string s1)
public function unsignedlong y_xor (unsignedlong n1, unsignedlong n2)
end prototypes

public function unsignedlong y_xor (unsignedlong n1, unsignedlong n2); unsignedlong     max,n,rtn;   
  long   i;   
  boolean   bit1[1   to   32],bit2[1   to   32];   
  /////////   
  max   =   2^32   -1;   
  for   i=1   to   32   
  bit1[i]=false     
  bit2[i]=false   
  next   
  for   i=31   to   0   step   -1   
  n   =   2^i;   
  if   n1>=n   then   
  bit1[i+1]=true;   
  n1   =   n1   -   n;   
  else   
  bit1[i+1]=false;   
  end   if   
  if   n2>=n   then   
  bit2[i+1]=true;   
  n2   =   n2   -   n;     
  else   
  bit2[i+1]=false;   
  end   if   
  next   
  for   i=1   to   32   
  if   bit1[i]   <>   bit2[i]   then   
  rtn   +=   2^(i   -1);   
  end   if   
  next      
    
  return   rtn;   

end function


public function long getlasterror ();
//GetLastError
//ĿģȡĴ룬Ϊ0ʾûд
//ؽĴ
//ע⣺ûڳʼһȫֱlong lasterror
	return LastError  
end function

public function int ServerConnect(string server,int c_port);
//Connect
//Ŀģӷ
//1server ҪӵķƻIPַ
//2c_port Ӷ˿,˿ںſԶ
//ؽ0ʾɹӷʾʧ
//ע⣺ʹκκ֮ǰһҪȵøúini֮ǰڳ˳ʱмһҪʹDisConnectServerϿ
	int result
	result=ConnectServer(server,c_port)
	if result<>0 then 
		MessageBox("","ӷ򣬴Ϊ"+string(result),Information! ,ok!)
	end if
	AutoDisConnect (60000, True) //ڳʱԶϿЧӣʱʱΪ60
	return result
end function

#f_ini#
#f_ini_3#
#f_CheckKey#
#f_YAdd#
#f_Yand#
#f_Ycompare#
#f_YCompareString#
#f_YDecrease#
#f_YDivide#
#f_Ymultiply#
#f_Yor#
#f_YSetValue#
#f_Ystrcat#
#f_Ystrcpy#

on @ytclass.create
call super::create
TriggerEvent( this, "constructor" )
end on

on @ytclass.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on

