// MBUserProFun.cpp : implementation file
|
//
|
|
#include "stdafx.h"
|
#include "MBUserProFun.h"
|
|
|
// CMBUserProFun
|
|
CMBUserProFun::CMBUserProFun()
|
{
|
}
|
|
CMBUserProFun::~CMBUserProFun()
|
{
|
}
|
|
|
// CMBUserProFun member functions
|
|
CString CMBUserProFun::GetMBDefIniFile()
|
{
|
CString strFileName;
|
|
strFileName.Format( _T("%s\\Data\\%s"), CBaseCommFun::GetWorkDir() , INI_CONFIGFILE );
|
return strFileName;
|
}
|
CString CMBUserProFun::GetMBSetupIniFile()
|
{
|
CString strFileName;
|
|
strFileName.Format( _T("%s\\Data\\%s"), CBaseCommFun::GetWorkDir() , INI_MBSETUPCONFIGFILE );
|
return strFileName;
|
}
|
|
BOOL CMBUserProFun::LoadBeepEnableInfo(BOOL &bBeepEnable, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile( strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_BEEPENABLE,0, strInitFile );
|
bBeepEnable = (dwValue != 0);
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::SaveBeepEnableInfo( BOOL bBeepEnable, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bBeepEnable);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_BEEPENABLE, strValue ,strInitFile );
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::LoadBeepSoundData( int &nBeepFre, int &nBeepDur, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_BEEPFRE,400, strInitFile );
|
nBeepFre = dwValue;
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_BEEPDUR,100, strInitFile );
|
nBeepDur = dwValue;
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::SaveBeepSoundData( int &nBeepFre, int &nBeepDur, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), nBeepFre);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_BEEPFRE, strValue ,strInitFile );
|
strValue.Format(_T("%d"), nBeepDur);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_BEEPDUR, strValue ,strInitFile );
|
return TRUE;
|
}
|
|
//==================================================================
|
// µÃµ½Õë¶ÔijһÓõÄÉùÒôÅäÖÃ
|
//
|
// Èç¹ûΪauto = TRUE , µ±µÃ²»µ½¸öÈ˵ÄÉùÒôÎļþʱ,·µ¼Ó
|
// È«¾ÖµÄÉùÒôÎļþ
|
//==================================================================
|
CString CMBUserProFun::GetPSoundFileName( CString strAppLoginName, CString strServerID , CString strPLoginName, CString strSoundType , BOOL bAuto)
|
{
|
CString strReturn,strFile;
|
|
strFile = GetMyIniFile( strAppLoginName, strServerID);
|
GetPrivateProfileString( strPLoginName , strSoundType , _T("") , strReturn.GetBuffer(1024), 1024, strFile);
|
strReturn.ReleaseBuffer();
|
if( strReturn.IsEmpty() )
|
{
|
if( bAuto )
|
{
|
strFile = GetMyIniFile( strAppLoginName, strServerID );
|
GetPrivateProfileString( SYSSET_SOUND_SECTION , strSoundType , _T("") , strReturn.GetBuffer(1024), 1024 , strFile );
|
strReturn.ReleaseBuffer();
|
}
|
}
|
|
return strReturn;
|
}
|
|
//==================================================
|
// ±£´æÕë¶ÔijһÓüǵÄÉùÒôÅäÖÃ
|
//==================================================
|
void CMBUserProFun::SavePSoundInfo( CString strAppLoginName, CString strServerID , CString strPLoginName ,CStringArray &asSoundType , CStringArray &asSoundFile )
|
{
|
CString strSoundType;
|
CString strSoundFile;
|
int nIndex,nCount;
|
CString strTemp,strFile;
|
|
if(strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return;
|
strFile = GetMyIniFile( strAppLoginName, strServerID );
|
nCount = asSoundType.GetSize();
|
strTemp.Format( _T("%d") , nCount );
|
WritePrivateProfileString( SYSSET_SOUND_SECTION, _T("SOUNDCOUNT"), strTemp ,strFile );
|
for ( nIndex = 0; nIndex < nCount; nIndex++ )
|
{
|
strSoundType = asSoundType.GetAt( nIndex );
|
strSoundFile = asSoundFile.GetAt( nIndex );
|
|
WritePrivateProfileString( strPLoginName, strSoundType, strSoundFile ,strFile );
|
}
|
}
|
|
// µÃµ½µ±Ç°Óû§µÄÈ˸öÅäÖÃÎļþÃû
|
CString CMBUserProFun::GetMyIniFile( CString strLoginName, CString strServerID )
|
{
|
CString strFileName;
|
|
strFileName.Format( _T("%s\\%s"),GetMyDataDir(strLoginName, strServerID) , INI_MYCONFIGFILE );
|
return strFileName;
|
}
|
|
BOOL CMBUserProFun::LoadMsgOpenNotify( BOOL &bIsMsgOpenNotify, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
bIsMsgOpenNotify = FALSE;
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_OPENMSGNOTIFY,0, strInitFile );
|
if ( dwValue == 0 )
|
bIsMsgOpenNotify = FALSE;
|
else
|
bIsMsgOpenNotify = TRUE;
|
return TRUE;
|
}
|
BOOL CMBUserProFun::SaveMsgOpenNotify( BOOL bIsMsgOpenNotify, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bIsMsgOpenNotify);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_OPENMSGNOTIFY, strValue ,strInitFile );
|
return TRUE;
|
}
|
|
void CMBUserProFun::LoadQuickKey( BOOL &bCloseQuickKey, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
bCloseQuickKey = FALSE;
|
dwValue = GetPrivateProfileInt(SYSSET_MBC_SECTION, SYSSET_MBC_SECTION_CLOSEQUICKKEY,0, strInitFile );
|
if ( dwValue == 0 )
|
bCloseQuickKey = FALSE;
|
else
|
bCloseQuickKey = TRUE;
|
}
|
BOOL CMBUserProFun::SaveQuickKey( BOOL bCloseQuickKey, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bCloseQuickKey);
|
WritePrivateProfileString( SYSSET_MBC_SECTION, SYSSET_MBC_SECTION_CLOSEQUICKKEY, strValue ,strInitFile );
|
return TRUE;
|
}
|
|
void CMBUserProFun::LoadProtectAwy( BOOL &bIsProtectAwy, BOOL &bIsAutoAwy, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_USEPROTECT,0, strInitFile );
|
if ( dwValue == 0 )
|
bIsProtectAwy = FALSE;
|
else
|
bIsProtectAwy = TRUE;
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_AUTOAWY,0, strInitFile );
|
if ( dwValue == 0 )
|
bIsAutoAwy = FALSE;
|
else
|
bIsAutoAwy = TRUE;
|
|
}
|
|
void CMBUserProFun::LoadProtectAwyTime( int &nHookAwyTime, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_AUTOAWYTIME,0, strInitFile );
|
nHookAwyTime = dwValue;
|
|
}
|
|
BOOL CMBUserProFun::SaveProtectAwy( BOOL bIsProtectAwy, BOOL bIsAutoAwy, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bIsProtectAwy);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_USEPROTECT, strValue ,strInitFile );
|
strValue.Format(_T("%d"), bIsAutoAwy);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_AUTOAWY, strValue ,strInitFile );
|
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::SaveProtectAwyTime( int nTime, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), nTime);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_AUTOAWYTIME, strValue ,strInitFile );
|
|
return TRUE;
|
}
|
|
|
BOOL CMBUserProFun::LoadCanHideLogin( BOOL &bHideLogin, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
|
bHideLogin = FALSE;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_HIDELOGIN,0, strInitFile );
|
if ( dwValue != 0 )
|
bHideLogin = TRUE;
|
return TRUE;
|
}
|
BOOL CMBUserProFun::SaveCanHideLogin(BOOL bHideLogin,CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bHideLogin);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_HIDELOGIN, strValue ,strInitFile );
|
return TRUE;
|
}
|
void CMBUserProFun::LoadDefMakeCopy( BOOL &bDefMakeCopy, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_MAKECOPY, 0, strInitFile );
|
if ( dwValue == 0 )
|
bDefMakeCopy = FALSE;
|
else
|
bDefMakeCopy = TRUE;
|
}
|
BOOL CMBUserProFun::SaveDefMakeCopy( BOOL bDefMakeCopy, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bDefMakeCopy);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_MAKECOPY, strValue ,strInitFile );
|
return TRUE;
|
}
|
BOOL CMBUserProFun::IsLoadChatHisRecord( CString strAppLoginName, CString strServerID )
|
{
|
BOOL bLoadLog = TRUE;
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_LOADCHATHISRECORD,1, strInitFile );
|
if ( dwValue == 0 )
|
bLoadLog = FALSE;
|
else
|
bLoadLog = TRUE;
|
return bLoadLog;
|
}
|
|
BOOL CMBUserProFun::SaveLoadChatHisRecord( BOOL bLoadLog, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bLoadLog);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_LOADCHATHISRECORD, strValue ,strInitFile );
|
return TRUE;
|
}
|
|
|
// =========================================================================
|
// µÃµ½¿ì½Ý»Ø¸´ÐÅÏ¢
|
// ¸ñʽ£ºItem%d = Ãû³Æ;ÄÚÈÝ
|
// =========================================================================
|
int CMBUserProFun::LoadIDIData( CString strSection , CChatShortcutTermArray &arCHATSHORTCUTTERM, CString strAppLoginName, CString strServerID )
|
{
|
CString strResult;
|
CString strMyFile;
|
CString strFile;
|
TCHAR sData[1024];
|
int nNum,nCount;
|
CString strTemp;
|
CString strKey;
|
|
strFile.Format( _T("%s\\data\\%s"), CBaseCommFun::GetWorkDir(), INI_IDIFILE );
|
strMyFile.Format( _T("%s\\%s"), GetMyDataDir(strAppLoginName, strServerID), INI_IDIFILE );
|
if( !CBaseCommFun::ExistFile(strMyFile))
|
CopyFile(strFile,strMyFile , TRUE);
|
GetPrivateProfileString( strSection , _T("Count"), _T("0"), sData, 1024, strMyFile );
|
strTemp = sData;
|
nCount = _tstoi(strTemp);
|
|
int nPos;
|
CString strItem;
|
CHATSHORTCUTTERM shortcut;
|
|
arCHATSHORTCUTTERM.RemoveAll();
|
for( nNum = 1 ; nNum <= nCount ; nNum++ )
|
{
|
strKey.Format(_T("Item%d") , nNum );
|
GetPrivateProfileString( strSection , strKey , _T(""), sData, 1024, strMyFile );
|
strItem = sData;
|
|
strItem.TrimLeft();
|
strItem.TrimRight();
|
nPos = strItem.Find( _T(";") );
|
if ( nPos > 0 )
|
{
|
shortcut.strName = strItem.Left( nPos );
|
shortcut.strName.TrimRight();
|
shortcut.strName = shortcut.strName.Left( 20 ); // ÏÞÖÆ 20 ¸ö×Ö·û
|
shortcut.strContent = strItem.Mid( nPos + 1 );
|
shortcut.strContent.TrimLeft();
|
|
if ( !shortcut.strName.IsEmpty() && !shortcut.strContent.IsEmpty() )
|
arCHATSHORTCUTTERM.Add( shortcut );
|
}
|
}
|
|
return arCHATSHORTCUTTERM.GetSize();
|
}
|
|
// =========================================================================
|
BOOL CMBUserProFun::SaveIDIData( CString strSection , CChatShortcutTermArray &arCHATSHORTCUTTERM, CString strAppLoginName, CString strServerID )
|
{
|
CString strData;
|
int nCount, nNum;
|
CHATSHORTCUTTERM shortcut;
|
CString strFile;
|
CString strItem,strTemp;
|
CString strKey;
|
CString strPath;
|
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strFile.Format( _T("%s\\%s"), GetMyDataDir(strAppLoginName, strServerID), INI_IDIFILE );
|
nCount = arCHATSHORTCUTTERM.GetSize();
|
strTemp.Format( _T("%d"),nCount);
|
WritePrivateProfileString(strSection, _T("Count"), strTemp , strFile);
|
|
for ( nNum = 1; nNum <= nCount; nNum++ )
|
{
|
shortcut = arCHATSHORTCUTTERM.GetAt( nNum - 1 );
|
if ( !shortcut.strName.IsEmpty() && !shortcut.strContent.IsEmpty() )
|
{
|
strItem.Format( _T("%s;%s"), shortcut.strName, shortcut.strContent );
|
strKey.Format( _T("Item%d"), nNum );
|
WritePrivateProfileString(strSection, strKey, strItem , strFile);
|
}
|
}
|
return TRUE;
|
}
|
// =========================================================================
|
int CMBUserProFun::LoadAttitudeIDIData( CString strSection , CChatShortcutTermArray &arAttitudeIDI, CString strAppLoginName , CString strServerID )
|
{
|
CString strResult;
|
CString strFile;
|
CString strMyFile;
|
TCHAR sData[1024];
|
int nNum,nCount;
|
CString strTemp;
|
CString strKey;
|
|
strFile.Format( _T("%s\\data\\%s"), CBaseCommFun::GetWorkDir(), INI_IDIFILE );
|
strMyFile.Format( _T("%s\\%s"), GetMyDataDir(strAppLoginName, strServerID), INI_IDIFILE );
|
if( !CBaseCommFun::ExistFile(strMyFile))
|
CopyFile(strFile,strMyFile , TRUE );
|
GetPrivateProfileString( strSection , _T("Count"), _T("0"), sData, 1024, strMyFile );
|
strTemp = sData;
|
nCount = _tstoi(strTemp);
|
|
int nPos;
|
CString strItem;
|
CHATSHORTCUTTERM shortcut;
|
|
arAttitudeIDI.RemoveAll();
|
for( nNum = 1 ; nNum <= nCount ; nNum++ )
|
{
|
strKey.Format(_T("Item%d") , nNum );
|
GetPrivateProfileString( strSection , strKey , _T(""), sData, 1024, strMyFile );
|
strItem = sData;
|
|
strItem.TrimLeft();
|
strItem.TrimRight();
|
nPos = strItem.Find( _T(";") );
|
if ( nPos > 0 )
|
{
|
shortcut.strName = strItem.Left( nPos );
|
shortcut.strName.TrimRight();
|
shortcut.strName = shortcut.strName.Left( 20 ); // ÏÞÖÆ 20 ¸ö×Ö·û
|
shortcut.strContent = strItem.Mid( nPos + 1 );
|
shortcut.strContent.TrimLeft();
|
|
if ( !shortcut.strName.IsEmpty() && !shortcut.strContent.IsEmpty() )
|
arAttitudeIDI.Add( shortcut );
|
}
|
}
|
|
return arAttitudeIDI.GetSize();
|
}
|
|
BOOL CMBUserProFun::LoadHotKeyInfo( CHotKeyItemArray &arHotKey, CString strAppLoginName, CString strServerID )
|
{
|
CString strSubKey;
|
CString strValue;
|
CString strName;
|
CString strHotKeyValue;
|
CString strHotKey;
|
HOTKEYITEM itemHotKey;
|
TCHAR szValue[256] = { 0 };
|
CString strInitFile;
|
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
arHotKey.RemoveAll();
|
GetPrivateProfileString( SYSSET_HOTKEY_SECTION, _T( "order" ) , _T("") , szValue, 256 , strInitFile );
|
strValue.Format(_T("%s"), szValue);
|
if( !CBaseStringMgr::GetElementItem(strValue,strName,_T(",")))
|
{
|
return TRUE;
|
}
|
while(!strName.IsEmpty())
|
{
|
itemHotKey.strName = strName;
|
GetPrivateProfileString( SYSSET_HOTKEY_SECTION, strName , _T("") , szValue, 256 , strInitFile );
|
strHotKeyValue.Format(_T("%s"), szValue);
|
CBaseStringMgr::GetElementItem(strHotKeyValue,strHotKey,_T(","));
|
if( !strHotKey.IsEmpty())
|
itemHotKey.bDefault = _tstoi(strHotKey) != 0;
|
CBaseStringMgr::GetElementItem(strHotKeyValue,strHotKey,_T(","));
|
if( !strHotKey.IsEmpty())
|
itemHotKey.wDefVirtualKeyCode = _tstoi(strHotKey);
|
CBaseStringMgr::GetElementItem(strHotKeyValue,strHotKey,_T(","));
|
if( !strHotKey.IsEmpty())
|
itemHotKey.wDefModifiers = _tstoi(strHotKey);
|
CBaseStringMgr::GetElementItem(strHotKeyValue,strHotKey,_T(","));
|
if( !strHotKey.IsEmpty())
|
itemHotKey.wVirtualKeyCode = _tstoi(strHotKey);
|
CBaseStringMgr::GetElementItem(strHotKeyValue,strHotKey,_T(","));
|
if( !strHotKey.IsEmpty())
|
itemHotKey.wModifiers = _tstoi(strHotKey);
|
arHotKey.Add(itemHotKey);
|
if( !CBaseStringMgr::GetElementItem(strValue,strName,_T(",")))
|
break;
|
}
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::SaveHotKeyInfo( CHotKeyItemArray &arHotKey, CString strAppLoginName , CString strServerID )
|
{
|
int nIndex,nCount;
|
HOTKEYITEM itemHotKey;
|
CString strHotKeyName;
|
CString strHotKey;
|
CString strInitFile;
|
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
|
strHotKeyName = _T("");
|
nCount = arHotKey.GetCount();
|
for(nIndex = 0; nIndex < nCount; nIndex++)
|
{
|
itemHotKey = arHotKey.GetAt(nIndex);
|
strHotKeyName += itemHotKey.strName + _T(",");
|
strHotKey.Format(_T("%d,%d,%d,%d,%d"),itemHotKey.bDefault ? 1 : 0,
|
itemHotKey.wDefVirtualKeyCode,itemHotKey.wDefModifiers,itemHotKey.wVirtualKeyCode, itemHotKey.wModifiers );
|
WritePrivateProfileString( SYSSET_HOTKEY_SECTION, itemHotKey.strName, strHotKey ,strInitFile );
|
}
|
WritePrivateProfileString( SYSSET_HOTKEY_SECTION, _T( "order" ), strHotKeyName ,strInitFile );
|
return TRUE;
|
}
|
|
|
BOOL CMBUserProFun::IsEnterSend(CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_ENTERSEND , 0 , strInitFile );
|
if ( dwValue == 0 )
|
return FALSE;
|
return TRUE;
|
}
|
void CMBUserProFun::SetEnterSend( BOOL bEnterSend, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bEnterSend);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_ENTERSEND, strValue ,strInitFile );
|
}
|
|
//========================================
|
// ÊÇ·ñΪ×Ô¶¯¶Ô»°Ä£Ê½
|
//========================================
|
BOOL CMBUserProFun::IsAutoChat( CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_AUTOCHAT , 0 , strInitFile );
|
if ( dwValue == 1 )
|
return TRUE;
|
return FALSE;
|
}
|
|
//========================================
|
// ÊÇ·ñΪ×Ô¶¯¶Ô»°Ä£Ê½
|
//========================================
|
BOOL CMBUserProFun::SetAutoChat( BOOL bAutoChat, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bAutoChat);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_AUTOCHAT, strValue ,strInitFile );
|
|
return TRUE;
|
}
|
|
|
|
//=======================================================
|
// ±£´æÏµÍ³ÉùÒôÅäÖõ½ Config.ini ÖÐ
|
//=======================================================
|
BOOL CMBUserProFun::SaveEventSound( CEventSoundArray &arEventSound, CString strAppLoginName, CString strServerID )
|
{
|
EVENTSOUND eventSound;
|
int nCount, nIndex;
|
CString strInitFile;
|
CString strSubKey;
|
CRegKey reg;
|
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
|
nCount = arEventSound.GetSize();
|
for ( nIndex = 0; nIndex < nCount; nIndex++ )
|
{
|
eventSound = arEventSound.GetAt( nIndex );
|
|
WritePrivateProfileString (SYSSET_SOUND_SECTION, eventSound.strEvent, eventSound.strSoundFile ,strInitFile );
|
}
|
|
return TRUE;
|
}
|
|
//=======================================================
|
// ×°ÔØÏµÍ³ÉùÒôÅäÖõ½ Config.ini ÖÐ
|
//=======================================================
|
BOOL CMBUserProFun::LoadEventSound( CEventSoundArray &arEventSound, CString strAppLoginName, CString strServerID )
|
{
|
EVENTSOUND eventSound;
|
unsigned int nCount, nIndex;
|
CString strInitFile;
|
CString strSubKey;
|
CRegKey reg;
|
unsigned int func_rtn;
|
TCHAR strBuf[1024 * 10];
|
TCHAR strKey[256];
|
int CountPrivate;
|
int nPos;
|
|
nIndex = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
func_rtn = GetPrivateProfileSection(SYSSET_SOUND_SECTION, strBuf,1024 * 10, strInitFile);
|
nCount = 0;
|
while(nCount < func_rtn)
|
{
|
memset(strKey, 0,256 * sizeof(TCHAR));/**/
|
memcpy(strKey, &strBuf[nCount],_tcslen(&strBuf[nCount])* sizeof(TCHAR));/**/
|
CountPrivate = _tcslen(&strBuf[nCount]) + 1;/**/
|
nCount += CountPrivate;/**/
|
strSubKey.Format(_T("%s"), strKey);
|
nPos = strSubKey.Find(_T("="));
|
if(nPos < 0)
|
continue;
|
eventSound.strEvent = strSubKey.Left(nPos);
|
eventSound.strSoundFile = strSubKey.Mid(nPos+1);
|
eventSound.strEventDesc = eventSound.strEvent;
|
arEventSound.Add(eventSound);
|
}
|
return TRUE;
|
}
|
|
//=========================================================
|
// ·µ»ØÖµËµÃ÷£º-1²»´æÔÚ£»0£»1
|
//=========================================================
|
void CMBUserProFun::SetPropExtValue( CString strName,CString strValue, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
WritePrivateProfileString( SYSSET_AM_SECTION, strName, strValue ,strInitFile );
|
}
|
//=========================================================
|
// ·µ»ØÖµËµÃ÷£º-1²»´æÔÚ£»0£»1
|
//=========================================================
|
long CMBUserProFun::GetPropExtValue( CString strName, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
long nValue = -1;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, strName , 0 , strInitFile );
|
nValue = dwValue != 0;
|
return nValue;
|
}
|
BOOL CMBUserProFun::LoadCaptureHideCurWnd( BOOL &bHide , CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
bHide = FALSE;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_CAPTUREHCH , 0 , strInitFile );
|
bHide = dwValue != 0;
|
return bHide;
|
}
|
|
BOOL CMBUserProFun::SaveCaptureHideCurWnd( BOOL bHide, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bHide);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_CAPTUREHCH, strValue ,strInitFile );
|
|
return TRUE;
|
}
|
BOOL CMBUserProFun::LoadValAliasName( BOOL &bShowUserInfo, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
DWORD dwValue = 0;
|
bShowUserInfo = FALSE;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_VALALIASNAME , 1, strInitFile );
|
bShowUserInfo = dwValue != 0;
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::SaveValAliasName( BOOL bShowUserInfo, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bShowUserInfo);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_VALALIASNAME, strValue ,strInitFile );
|
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::LoadShowUserInfo( BOOL &bShowUserInfo, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
DWORD dwValue = 0;
|
bShowUserInfo = FALSE;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_SHOWUSERINFO , 1, strInitFile );
|
bShowUserInfo = dwValue != 0;
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::SaveShowUserInfo( BOOL bShowUserInfo, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bShowUserInfo);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_SHOWUSERINFO, strValue ,strInitFile );
|
|
return TRUE;
|
}
|
|
|
BOOL CMBUserProFun::IsUseBase64TransferFile(CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
DWORD dwValue = 0;
|
BOOL bIsUseBase64;
|
bIsUseBase64 = FALSE;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_USEBASE64FILE , 0, strInitFile );
|
bIsUseBase64 = dwValue != 0;
|
return bIsUseBase64;
|
}
|
|
BOOL CMBUserProFun::SaveUseBase64TransferFile( BOOL bIsUseBase64, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bIsUseBase64);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_USEBASE64FILE, strValue ,strInitFile );
|
|
return TRUE;
|
}
|
|
|
BOOL CMBUserProFun::LoadTaskCreate( CString &strValue )
|
{
|
CString strInitFile;
|
TCHAR szValue[256] = { 0 };
|
strInitFile = GetMBSetupIniFile();
|
GetPrivateProfileString(AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_TASKCREATE,_T(""), szValue,256, strInitFile );
|
strValue = szValue;
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::LoadQueryNoticeWeb(CString &strIssuedNotice,CString &strReceivedNotice )
|
{
|
CString strInitFile;
|
TCHAR szValue[256] = { 0 };
|
|
strInitFile = GetMBSetupIniFile();
|
GetPrivateProfileString(AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_ISSUEDNOTICEWEB,_T(""), szValue,256, strInitFile );
|
strIssuedNotice = szValue;
|
memset(szValue,0,256 * sizeof(TCHAR));
|
GetPrivateProfileString(AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_RECEIVEDNOTICEWEB,_T(""), szValue,256, strInitFile );
|
strReceivedNotice = szValue;
|
return TRUE;
|
}
|
BOOL CMBUserProFun::IsInstantMessFirstPlace( )
|
{
|
CString strInitFile;
|
strInitFile = GetMBSetupIniFile();
|
DWORD dwValue = GetPrivateProfileInt(AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_INSTANTMESSFIRST , 1 , strInitFile );
|
if(dwValue)
|
return TRUE;
|
else
|
return FALSE;
|
}
|
BOOL CMBUserProFun::IsUnlineUserShowDefaultIco( )
|
{
|
CString strInitFile;
|
strInitFile = GetMBSetupIniFile();
|
DWORD dwValue = GetPrivateProfileInt(AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_UNLINEUSERDEFAULTICO , 0 , strInitFile );
|
if(dwValue)
|
return TRUE;
|
else
|
return FALSE;
|
}
|
BOOL CMBUserProFun::IsUserStateNotSort( )
|
{
|
CString strInitFile;
|
strInitFile = GetMBSetupIniFile();
|
DWORD dwValue = GetPrivateProfileInt(AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_USERSTATENOTSORT , 0 , strInitFile );
|
if(dwValue)
|
return TRUE;
|
else
|
return FALSE;
|
}
|
void CMBUserProFun::SetUserStateNotSort(BOOL bNotSort )
|
{
|
CString strInitFile;
|
strInitFile = GetMBSetupIniFile();
|
CString strValue;
|
strValue.Format(_T("%d"), bNotSort ? 1 : 0);
|
WritePrivateProfileString( AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_USERSTATENOTSORT, strValue ,strInitFile );
|
}
|
BOOL CMBUserProFun::IsMsgDlgCanMove( )
|
{
|
CString strInitFile;
|
strInitFile = GetMBSetupIniFile();
|
DWORD dwValue = GetPrivateProfileInt(AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_MSGDLGCANMOVE , 0 , strInitFile );
|
if(dwValue)
|
return TRUE;
|
else
|
return FALSE;
|
}
|
BOOL CMBUserProFun::LoadDlgSize(CString strName, int &nWidth,int &nHeight)
|
{
|
nWidth = 0;
|
nHeight = 0;
|
if(strName.IsEmpty())
|
return FALSE;
|
CString strInitFile;
|
CString strValue;
|
CString strSubValue;
|
TCHAR szValue[256] = { 0 };
|
strInitFile = GetMBSetupIniFile();
|
GetPrivateProfileString(AMSET_AMSETUP_SECTION, strName,_T(""), szValue,256, strInitFile );
|
strValue = szValue;
|
CBaseStringMgr::GetElementItem( strValue , strSubValue , _T(",") );
|
nWidth = _tstol(strSubValue);
|
strValue = strSubValue;
|
nHeight = _tstol(strSubValue);
|
return TRUE;
|
}
|
|
void CMBUserProFun::SaveTreeShowStyle( int nTreeShowStyle, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
CString strValue;
|
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), nTreeShowStyle);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_VIEWSHOWSTYLE, strValue ,strInitFile );
|
}
|
|
int CMBUserProFun::GetTreeShowStyle( CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_VIEWSHOWSTYLE,0, strInitFile );
|
return dwValue;
|
}
|
|
void CMBUserProFun::SaveCrowdSortStyle( int nSortStyle, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
CString strValue;
|
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), nSortStyle);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_CROWDSORTSTYLE, strValue ,strInitFile );
|
}
|
|
int CMBUserProFun::GetCrowdSortStyle( CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_CROWDSORTSTYLE,0, strInitFile );
|
return dwValue;
|
}
|
|
|
CString CMBUserProFun::GetMyDataDir( CString strUser, CString strServerID)
|
{
|
CString strFileDir;
|
CString strUserDir;
|
DWORD dwAttributes = DWORD(-1);
|
|
if(strUser.IsEmpty() || strServerID.IsEmpty())
|
{
|
strFileDir.Format( _T("%s\\Data"), CBaseCommFun::GetWorkDir() );
|
dwAttributes = GetFileAttributes( strFileDir) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory( strFileDir, NULL );
|
return strFileDir;
|
}
|
strFileDir.Format( _T("%s\\Users"), CBaseCommFun::GetWorkDir() );
|
dwAttributes = GetFileAttributes( strFileDir) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory( strFileDir, NULL );
|
strUserDir.Format( _T("%s\\%s"), strFileDir, strUser );
|
dwAttributes = GetFileAttributes( strUserDir) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory( strUserDir, NULL );
|
strFileDir = strUserDir;
|
strUserDir.Format( _T("%s\\%s"), strFileDir , strServerID );
|
dwAttributes = GetFileAttributes( strUserDir) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
{
|
DeleteFile(strUserDir);
|
::CreateDirectory( strUserDir, NULL );
|
}
|
return strUserDir;
|
}
|
BOOL CMBUserProFun::CheckUserDataDir( CString strUser, CString strServerID)
|
{
|
CString strFileDir;
|
CString strTempDir;
|
DWORD dwAttributes = DWORD(-1);
|
|
strTempDir.Format( _T("%s\\Users\\%s"), CBaseCommFun::GetWorkDir(), strUser );
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
return FALSE;
|
strFileDir.Format( _T("%s\\%s"), strTempDir, strServerID );
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
return FALSE;
|
return TRUE;
|
}
|
//===================================================
|
// º¯Êý×÷Ó㺲úÉúÒ»¸öGUID£¬×÷Ϊ×Ö·û´®·µ»Ø
|
//===================================================
|
CString CMBUserProFun::GenStringID( )
|
{
|
CString str;
|
GUID guid = GUID_NULL;
|
::CoCreateGuid(&guid);
|
|
ASSERT(guid != GUID_NULL);// call ::CoInitialize() in CWinApp::OnInitIntance()
|
// to avoid it.
|
|
CString strFormat = _T("%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X");
|
str.Format(strFormat,
|
// first copy...
|
guid.Data1, guid.Data2, guid.Data3,
|
guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
|
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7],
|
// second copy...
|
guid.Data1, guid.Data2, guid.Data3,
|
guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
|
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
|
return str;
|
}
|
|
CString CMBUserProFun::GetAdminTempFolder( )
|
{
|
|
TCHAR szTempPath[MAX_PATH] = {0};
|
CString strTempFileName;
|
CString strFileItem;
|
DWORD dwAttributes = DWORD(-1);
|
|
::GetTempPath(MAX_PATH, szTempPath);
|
strTempFileName = szTempPath;
|
strTempFileName.TrimRight('\\');
|
strTempFileName.TrimRight('/');
|
|
/*strTempFileName = strTempFileName.Left( 2 );
|
strTempFileName = strTempFileName + _T( "\\Documents and Settings" );
|
dwAttributes = GetFileAttributes( strTempFileName) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory(strTempFileName, NULL);
|
strTempFileName = strTempFileName + _T( "\\Administrator" );
|
dwAttributes = GetFileAttributes( strTempFileName) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory(strTempFileName, NULL);
|
strTempFileName = strTempFileName + _T( "\\Temp" );
|
dwAttributes = GetFileAttributes( strTempFileName) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory(strTempFileName, NULL);*/
|
return strTempFileName;
|
}
|
CString CMBUserProFun::GetWorkTempFolder( )
|
{
|
|
TCHAR szTempPath[MAX_PATH] = {0};
|
CString strTempFileName;
|
CString strFileItem;
|
DWORD dwAttributes = DWORD(-1);
|
|
strTempFileName = CBaseCommFun::GetWorkDir();
|
strTempFileName.TrimRight('\\');
|
strTempFileName.TrimRight('/');
|
/*::GetTempPath(MAX_PATH, szTempPath);
|
strTempFileName = szTempPath;
|
strTempFileName.TrimRight('\\');
|
strTempFileName.TrimRight('/');
|
|
strTempFileName = strTempFileName.Left( 2 );
|
strTempFileName = strTempFileName + _T( "\\Documents and Settings" );
|
dwAttributes = GetFileAttributes( strTempFileName) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory(strTempFileName, NULL);
|
strTempFileName = strTempFileName + _T( "\\Administrator" );
|
dwAttributes = GetFileAttributes( strTempFileName) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory(strTempFileName, NULL);*/
|
|
strTempFileName = strTempFileName + _T( "\\Temp" );
|
dwAttributes = GetFileAttributes( strTempFileName) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory(strTempFileName, NULL);
|
return strTempFileName;
|
}
|
|
CString CMBUserProFun::GetWorkDownloadFolder( CString strUser)
|
{
|
CString strFileDir;
|
CString strUserDir;
|
DWORD dwAttributes = DWORD(-1);
|
if(strUser.IsEmpty())
|
{
|
strFileDir.Format( _T("%s\\Dwonload"), CBaseCommFun::GetWorkDir() );
|
dwAttributes = GetFileAttributes( strFileDir) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory( strFileDir, NULL );
|
return strFileDir;
|
}
|
strFileDir.Format( _T("%s\\Users"), CBaseCommFun::GetWorkDir() );
|
dwAttributes = GetFileAttributes( strFileDir) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory( strFileDir, NULL );
|
strUserDir.Format( _T("%s\\%s"), strFileDir, strUser );
|
dwAttributes = GetFileAttributes( strUserDir) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
::CreateDirectory( strUserDir, NULL );
|
strFileDir = strUserDir;
|
strUserDir.Format( _T("%s\\Dwonload"), strFileDir );
|
dwAttributes = GetFileAttributes( strUserDir) ;
|
if(dwAttributes == DWORD(-1) || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
|
{
|
DeleteFile(strUserDir);
|
::CreateDirectory( strUserDir, NULL );
|
}
|
return strUserDir;
|
}
|
|
//µÃµ½µç»°²¾µÄ·¾¶
|
BOOL CMBUserProFun::GetPhoneBookPath(CString strUser, CString strServerID , CString &strPath )
|
{
|
CString strMyDataDir;
|
|
strMyDataDir = GetMyDataDir(strUser,strServerID);
|
strPath.Format(_T("%s\\PhoneBook.xml"), strMyDataDir);
|
|
return TRUE;
|
}
|
|
void CMBUserProFun::LoadDefaultDwonloadPath( CString &strDefaultDwonloadPath, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
TCHAR szValue[256] = { 0 };
|
|
strDefaultDwonloadPath = _T("");
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
GetPrivateProfileString(SYSSET_MBC_SECTION, SYSSET_MBC_SECTION_DOWNLOADPATH,_T(""), szValue,256, strInitFile );
|
strDefaultDwonloadPath = szValue;
|
}
|
|
void CMBUserProFun::SaveDefaultDwonloadPath(CString strDefaultDwonloadPath, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
WritePrivateProfileString( SYSSET_MBC_SECTION, SYSSET_MBC_SECTION_DOWNLOADPATH, strDefaultDwonloadPath ,strInitFile );
|
}
|
//========================================
|
// ÊÇ·ñÐèÒªÀ©Õ¹¹¦ÄÜ
|
//========================================
|
BOOL CMBUserProFun::IsHaveExSTKFunction( CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
DWORD dwValue = 0;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_HAVEEXFUNCTION , 0 , strInitFile );
|
if ( dwValue == 1 )
|
return TRUE;
|
return FALSE;
|
}
|
BOOL CMBUserProFun::LoadCompressLevel( long &nCompressLevel, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
nCompressLevel = -1;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
nCompressLevel = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_COMPRESSLEVEL , -1 , strInitFile );
|
return TRUE;
|
}
|
BOOL CMBUserProFun::SaveCompressLevel(long nCompressLevel, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), nCompressLevel);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_COMPRESSLEVEL, strValue ,strInitFile );
|
return TRUE;
|
}
|
|
|
|
//========================================
|
// ·¢ËÍÏûϢʱºòÊÖ»úÌáÐÑ
|
//========================================
|
BOOL CMBUserProFun::IsMobilePhoneRemind( BOOL &bRemind, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
|
bRemind = FALSE;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_MOBILEREMIND,0, strInitFile );
|
if ( dwValue == 0 )
|
return TRUE;
|
else
|
bRemind = TRUE;
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::SetMobilePhoneRemind( BOOL bRemind, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bRemind ? 1 : 0);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_MOBILEREMIND, strValue ,strInitFile );
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::IsHideLoginName( )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
strInitFile = GetMBDefIniFile();
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_HIDELOGINAME,0, strInitFile );
|
if ( dwValue == 0 )
|
{
|
return FALSE;
|
}
|
else
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::IsUserStateSort( BOOL &bUserStateSort,int &nSortTime, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
|
nSortTime = 2000;
|
bUserStateSort = FALSE;
|
if( IsUserStateNotSort())
|
{
|
return TRUE;
|
}
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_USERSTATESORT,1, strInitFile );
|
if ( dwValue == 0 )
|
{
|
return TRUE;
|
}
|
else
|
{
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_USERSORTTIME,2000, strInitFile );
|
if(dwValue < 0)
|
nSortTime = 0;
|
if(dwValue > 60 * 1000)
|
nSortTime = 60000;
|
else
|
nSortTime = dwValue;
|
bUserStateSort = TRUE;
|
}
|
return TRUE;
|
|
}
|
|
BOOL CMBUserProFun::SetUserStateSort( BOOL bUserStateSort,int nSortTime, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bUserStateSort? 1 : 0);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_USERSTATESORT, strValue ,strInitFile );
|
if( !bUserStateSort)
|
strValue.Format(_T("2000"));
|
else
|
strValue.Format(_T("%d"), nSortTime);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_USERSORTTIME, strValue ,strInitFile );
|
SetUserStateNotSort(FALSE);
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::IsCloseHeadFlashes( BOOL &bCloseHeadFlashes, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
|
bCloseHeadFlashes = FALSE;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
strInitFile = GetMBDefIniFile();
|
else
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_AM_SECTION, SYSSET_AM_SECTION_CLOSEHEADFLASHES,0, strInitFile );
|
if ( dwValue == 0 )
|
return TRUE;
|
else
|
bCloseHeadFlashes = TRUE;
|
return TRUE;
|
}
|
|
BOOL CMBUserProFun::CloseHeadFlashes( BOOL bCloseHeadFlashes, CString strAppLoginName, CString strServerID )
|
{
|
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return FALSE;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bCloseHeadFlashes ? 1 : 0);
|
WritePrivateProfileString( SYSSET_AM_SECTION, SYSSET_AM_SECTION_CLOSEHEADFLASHES, strValue ,strInitFile );
|
return TRUE;
|
}
|
|
|
BOOL CMBUserProFun::IsShowOrgUserCount( )
|
{
|
CString strInitFile;
|
strInitFile = GetMBSetupIniFile();
|
DWORD dwValue = GetPrivateProfileInt(AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_SHOWORGUSERCOUNT , 1 , strInitFile );
|
if(dwValue)
|
return TRUE;
|
else
|
return FALSE;
|
}
|
BOOL CMBUserProFun::IsShowAMLog( )
|
{
|
CString strInitFile;
|
strInitFile = GetMBSetupIniFile();
|
DWORD dwValue = GetPrivateProfileInt(AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_SHOWLOG , 1 , strInitFile );
|
if(dwValue)
|
return TRUE;
|
else
|
return FALSE;
|
}
|
CString CMBUserProFun::GetUserDefineViewTabTip( )
|
{
|
CString strInitFile;
|
CString strUserDefineViewTab;
|
TCHAR szValue[256] = { 0 };
|
strInitFile = GetMBSetupIniFile();
|
GetPrivateProfileString(AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_USERDEFINETABTIP,_T("Ó¦Óü¯³É"), szValue,256, strInitFile );
|
strUserDefineViewTab = szValue;
|
strUserDefineViewTab.TrimRight();
|
if(strUserDefineViewTab.IsEmpty())
|
strUserDefineViewTab =_T("Ó¦Óü¯³É");
|
return strUserDefineViewTab;
|
}
|
|
CString CMBUserProFun::RenameDownloaFileNewExt( CString strFileName)
|
{
|
CString strInitFile;
|
TCHAR szValue[1204] = { 0 };
|
CString strValue;
|
CString strNewFileName;
|
CString strFileType;
|
CString strFileExt;
|
|
strNewFileName = strFileName;
|
strFileType = CBaseCommFun::GetFileType( strFileName );
|
strFileType.TrimLeft(_T("."));
|
strFileExt = strFileType;
|
if(strFileType.IsEmpty())
|
return strNewFileName;
|
strFileType.MakeLower();
|
strInitFile = GetMBSetupIniFile();
|
GetPrivateProfileString(AMSET_AMSETUP_SECTION, AMSET_AMSETUP_SECTION_DOWNLOADRENAMETYPE,_T(""),szValue,1204, strInitFile );
|
strValue = szValue;
|
CString strTempFileType;
|
while ( CBaseStringMgr::GetStrItem( strValue, strTempFileType, _T(",") ) )
|
{
|
strTempFileType.Trim();
|
strTempFileType.TrimLeft(_T("."));
|
strTempFileType.MakeLower();
|
if(strTempFileType == strFileType)
|
{
|
strNewFileName =strFileName.Left(strFileName.GetLength() - strFileExt.GetLength() - 1) + _T("_") + strFileExt;
|
break;
|
}
|
}
|
return strNewFileName;
|
}
|
|
|
void CMBUserProFun::GetCloseHint(BOOL &bIsNoHintClose, BOOL &bIsCloseIdExit, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
DWORD dwValue = 0;
|
|
bIsNoHintClose = FALSE;
|
bIsCloseIdExit = FALSE;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
dwValue = GetPrivateProfileInt(SYSSET_MBC_SECTION, SYSSET_MBC_SECTION_NOCLOSEHINT,0, strInitFile );
|
if ( dwValue == 1 )
|
bIsNoHintClose = TRUE;
|
else
|
bIsNoHintClose = FALSE;
|
dwValue = GetPrivateProfileInt(SYSSET_MBC_SECTION, SYSSET_MBC_SECTION_CLOSEISEXIT,0, strInitFile );
|
if ( dwValue == 1 )
|
bIsCloseIdExit = TRUE;
|
else
|
bIsCloseIdExit = FALSE;
|
}
|
|
void CMBUserProFun::SetCloseHint( BOOL bIsNoHintClose, BOOL bIsCloseIdExit, CString strAppLoginName, CString strServerID )
|
{
|
CString strInitFile;
|
CString strValue;
|
if( strAppLoginName.IsEmpty() || strServerID.IsEmpty() )
|
return;
|
strInitFile = GetMyIniFile(strAppLoginName, strServerID);
|
strValue.Format(_T("%d"), bIsNoHintClose);
|
WritePrivateProfileString( SYSSET_MBC_SECTION, SYSSET_MBC_SECTION_NOCLOSEHINT, strValue ,strInitFile );
|
strValue.Format(_T("%d"), bIsCloseIdExit);
|
WritePrivateProfileString( SYSSET_MBC_SECTION, SYSSET_MBC_SECTION_CLOSEISEXIT, strValue ,strInitFile );
|
}
|