⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 settings.h

📁 HDCP Key加密程序
💻 H
字号:
// Settings.h: interface for the CSettings class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SETTINGS_H__F5E4C3E3_446D_11D2_AEC0_EFC799BA9B70__INCLUDED_)
#define AFX_SETTINGS_H__F5E4C3E3_446D_11D2_AEC0_EFC799BA9B70__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

const int	m_nEnumBufSize = 4096;

class CIniFileSection
{
public:
	CIniFileSection();
	~CIniFileSection();

	void SetReferenced(BOOL bReferenced = TRUE);

	// Add a new key-value pair to this section.
	void AddKeyVal(CString strKey, CString strVal);

	CStringList*	GetKeyList() { return &m_KeyList; };


	// List of keys in this section
	CStringList		m_KeyList;

	// List of values in this section
	CStringList		m_ValueList;

	// CMap tht maps keys to values in this section
	CMapStringToString m_ValueMap;

	// This flag is set to TRUE whenever this section is
	// read or written to.  The, when saving the ini file,
	// a check can be made to see if this section has been
	// referenced.  If not, the section can optionally be
	// eliminated.
	BOOL			m_bReferenced;

	BOOL			m_bSortKeys;
};

class CIniFileData
{
public:
	CIniFileData(CString strFileName);
	~CIniFileData();

	CString				GetFileName();
	void				SetFileName(CString strNewName);
	BOOL				WriteIniFile(BOOL bEliminate = FALSE);
	CStringList*		GetSectionList() { return &m_SectionList; };
	CIniFileSection*	GetSection(CString strSection);
	CIniFileSection*	AddSection(CString strSection, CString strAddAfter = "");

private:
	CString			m_strFileName;
	CString			m_strSection;
	CString			m_strNextString;

	CStringList		m_SectionList;

	CMapStringToPtr m_SectionMap;  // Ptr's to CIniFileSection

};

class CIniFileList
{
public:
	~CIniFileList();

	static CPtrList			m_IniFileList;  // Ptr's to CIniFileData
	static CIniFileData*	m_pCurDataFile;

	BOOL					AddIniFile(CString strFileName);
	CIniFileData*			GetFile(CString strFileName);
	BOOL					Toss(CString strFileName);
};

class CSettings  
{
protected:
	void AlertUserNotFound(BOOL bReturn, LPCSTR strKey);

	char			m_szEnumBuf[m_nEnumBufSize];
	CString			m_strIniFile;
	CString			m_strSection;
	LPSTR			m_pNextString;

	static CIniFileList m_IniList;

	CIniFileSection* m_pCurSect;

	CStringList*	m_pKeyList;
	CMapStringToString* m_pValMap;

	POSITION		m_CurKeyPos;
	CString			m_CurKey;

	POSITION		m_CurValPos;
	CString			m_CurVal;

public:
	BOOL			m_bAlertNotFound;

	BOOL SaveIniFile(CString strFileName, BOOL bEliminate = FALSE, BOOL bToss = FALSE);
	BOOL ChangeIniFileName(CString strOldName, CString strNewName);
	void UnloadAllData();
	BOOL EnumSectionNames();

	int EnumKeyNames(LPCSTR lpstrSection, BOOL bAddSection = FALSE);

	int PrepareKeys(CStringList* pFileList, LPCSTR lpszSection, BOOL bAddSection = FALSE, BOOL bReload=FALSE);
	int PrepareKeys(LPCSTR lpszIniFile, LPCSTR lpszSection, BOOL bAddSection = FALSE, BOOL bReload=FALSE);
	int ResetKeys(LPCSTR lpszIniFile, LPCSTR lpszSection, BOOL bSortKeys=FALSE);

	BOOL GetNext();
	CString GetName();

	BOOL GetKeyVal(CString& strKey, CString &strValue);
	BOOL GetKeyVal(CString& strKey, int &nValue);

	BOOL GetValue(LPCSTR pszKey, int &nValue);
	BOOL GetValue(LPCSTR pszKey, unsigned int &nValue);
	BOOL GetValue(LPCSTR pszKey, CString &strValue);

	BOOL SetValue(LPCSTR pszKey, CString strValue);
    BOOL SetValue(LPCSTR pszKey, int nValue);

    void DeleteSection();

	CSettings();
	CSettings(LPCSTR lpszIniFile); //, LPCSTR lpszSection=NULL, LPCSTR lpszPath = NULL);
	virtual ~CSettings();
private:
};

#endif // !defined(AFX_SETTINGS_H__F5E4C3E3_446D_11D2_AEC0_EFC799BA9B70__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -