Exp=x
ModuleFileName=Function_1.cpp
hfile=true
hfileext=.h
@end
                                        
//´칤Զɣѡ񡰹ܼģ顱
#include "stdafx.h"
#include <time.h>
#include <math.h>
#include "@ytclass.h"

BOOL @ytclass::load_lib(void)
{
		hlib=LoadLibrary("ClientKeyDll");
		l_ConnectServer=(int  (__stdcall * ) (TCHAR *,int ))GetProcAddress(hlib,"ConnectServer"); 
		if(l_ConnectServer==NULL)return FALSE;
		l_DisconnectServer=(int (__stdcall * ) ())GetProcAddress(hlib,"DisconnectServer"); 
		if(l_DisconnectServer==NULL)return FALSE;
		l_FindPort_2=(int (__stdcall *)(  int ,TCHAR *,int ,TCHAR *))GetProcAddress(hlib,"FindPort_2");
		if(l_FindPort_2==NULL)return FALSE;
		l_FindPort_3=(int (__stdcall *)(TCHAR  *,   int ,TCHAR *))GetProcAddress(hlib,"FindPort_3");
		if(l_FindPort_3==NULL)return FALSE;
		l_FindPort_4=(int (__stdcall *)(TCHAR  *,   int ,TCHAR *,TCHAR *,TCHAR *))GetProcAddress(hlib,"FindPort_4");
		if(l_FindPort_4==NULL)return FALSE;
		l_Cal_2=(int (__stdcall *)(TCHAR  *, int ,int ,BYTE * ,BYTE * ,
								 BYTE * ,BYTE * ,TCHAR *,int ))GetProcAddress(hlib,"Cal_2");
		if(l_Cal_2==NULL)return FALSE;
		l_CalculateEx_3=(int (__stdcall *)(TCHAR  *, int ,int , BYTE * ,BYTE * ,
								 BYTE * ,BYTE * ,TCHAR *,int ))GetProcAddress(hlib,"CalculateEx_3");
		if(l_CalculateEx_3==NULL)return FALSE;
		l_E_Ex_3=(int (__stdcall*)(char * ,char *,char *,TCHAR *,TCHAR *))GetProcAddress(hlib,"E_Ex_3");
		if(l_E_Ex_3==NULL)return FALSE;
		l_AutoDisConnect=(void (__stdcall*)(int ,BOOL))GetProcAddress(hlib,"AutoDisConnect");
		if(l_AutoDisConnect==NULL)return FALSE;

	return TRUE;
}
//'ServerConnect
//'Ŀģӷ
//'1servername ҪӵķƻIPַ
//'2port Ӷ˿,˿ںſԶ
//'ؽ0ʾɹӷʾʧ
//'ע⣺ʹκκ֮ǰһҪȵøúini֮ǰڳ˳ʱмһҪʹDisConnectServerϿ
int @ytclass::ConnectServer (TCHAR *ServerName,int Port)
{
	int ret;
	ret=(*l_ConnectServer)(ServerName,Port);
	if (ret!=0 )
	{
		  MessageBox(NULL, "ӷ" ,"",MB_OK);
	}
	AutoDisConnect(60000, TRUE); //'ڳʱԶϿЧӣʱʱΪ60
	return	ret;
}
int @ytclass::DisconnectServer ()
{
	return (*l_DisconnectServer)();
}
int @ytclass::FindPort_2(  int start,TCHAR *FileName,int pos,TCHAR *OutPath)
{
	return (*l_FindPort_2)(start,FileName,pos,OutPath);
}
int @ytclass::FindPort_3(TCHAR  *FileName,   int pos,TCHAR *OutPath)
{
	return (*l_FindPort_3)(FileName,pos,OutPath);
}
int @ytclass::FindPort_4(TCHAR  *FileName,   int pos,TCHAR *HKey,TCHAR *LKey,TCHAR *OutPath)
{
	return (*l_FindPort_4)(FileName,pos,HKey,LKey,OutPath);
}
int @ytclass::Cal_2(TCHAR  *FileName, int start,int len,BYTE * ele1,BYTE * ele2,
						 BYTE * ele3,BYTE * ele4,TCHAR *InPath,int cycle)
{
	return (*l_Cal_2)(FileName,start,len,ele1,ele2,ele3,ele4,InPath,cycle);
}
int @ytclass::CalculateEx_3(TCHAR  *FileName, int start,int len, BYTE * ele1,BYTE * ele2,
						 BYTE * ele3,BYTE * ele4,TCHAR *InPath,int cycle)
{
	return (*l_CalculateEx_3)(FileName,start,len,ele1,ele2,ele3,ele4,InPath,cycle);
}
int @ytclass::E_Ex_3(char * HKey,char *LKey,char *FileName,TCHAR *DestName,TCHAR *InPath)
{
	return (*l_E_Ex_3)(HKey,LKey,FileName,DestName,InPath);
}
void @ytclass::AutoDisConnect(int timer,BOOL biao)
{
	 (*l_AutoDisConnect)(timer,biao);
}
@ytclass::@ytclass()//ĿģǷûдڣʾûû
{
	LastError=0;
	ZeroMemory(KeyPath,sizeof(KeyPath));
	if(!load_lib())
	{
		MessageBox(NULL,"ҲClientKeyDll̬⣬ȷϵͳдӦĶ̬⣬Ȼг","",MB_OK);
	}
}

//GetLastError
//ĿģȡĴ룬Ϊ0ʾûд
//ؽĴ
long @ytclass::YGetLastError()
{
	return LastError;
}

#f_Ini#

#f_Ini_3#

#f_compare#

#f_YAdd#

#f_YCheckKey#

#f_YCompareString#

#f_YCompareStringNoCase#

#f_YDecrease#

#f_YDivide#

#f_Ymultiply#

#f_YSetValue#

#f_Ystrcat#

#f_Ystrcpy#

#f_Ystrncat#

#f_YAnd#

#f_Yor#


@ytclass::~@ytclass()
{
	
	FreeLibrary(hlib);
}

