Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added CHDDirectory class and small tweaks
- Added CHDDirectory class to get data from the XBox HDD (used for only skins atm). - Small tweaks and clean ups. - Added the English localization XML file.
- Loading branch information
1 parent
1df9cdd
commit 9e26ece
Showing
41 changed files
with
1,706 additions
and
56 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include "FileItem.h" | ||
|
||
CFileItem::CFileItem(void) | ||
{ | ||
m_strPath = ""; | ||
} | ||
|
||
CFileItem::CFileItem(const CStdString& strLabel) | ||
{ | ||
m_strPath = ""; | ||
m_strLabel = strLabel; | ||
} | ||
|
||
CFileItem::~CFileItem() | ||
{ | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////////////// | ||
///// | ||
///// CFileItemList | ||
///// | ||
////////////////////////////////////////////////////////////////////////////////// | ||
|
||
CFileItemList::CFileItemList() | ||
{ | ||
} | ||
|
||
CFileItemList::~CFileItemList() | ||
{ | ||
Clear(); | ||
} | ||
|
||
CFileItem* CFileItemList::operator[] (int iItem) | ||
{ | ||
return Get(iItem); | ||
} | ||
|
||
CFileItem* CFileItemList::Get(int iItem) | ||
{ | ||
return m_items[iItem]; | ||
} | ||
|
||
void CFileItemList::Add(CFileItem* pItem) | ||
{ | ||
m_items.push_back(pItem); | ||
} | ||
|
||
int CFileItemList::Size() const | ||
{ | ||
return (int)m_items.size(); | ||
} | ||
|
||
void CFileItemList::Clear() | ||
{ | ||
if (m_items.size()) | ||
{ | ||
IVECFILEITEMS i; | ||
i = m_items.begin(); | ||
while (i != m_items.end()) | ||
{ | ||
CFileItem* pItem = *i; | ||
delete pItem; | ||
i = m_items.erase(i); | ||
} | ||
m_map.clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#ifndef H_CFILEITEM | ||
#define H_CFILEITEM | ||
|
||
#include "guilib\GUIListItem.h" | ||
#include <map> | ||
#include <vector> | ||
|
||
class CFileItem : public CGUIListItem | ||
{ | ||
public: | ||
CFileItem(void); | ||
CFileItem(const CStdString& strLabel); | ||
~CFileItem(); | ||
|
||
void SetPath(CStdString strPath) { m_strPath = strPath; }; | ||
|
||
private: | ||
CStdString m_strPath; | ||
}; | ||
|
||
/*! | ||
\brief A vector of pointer to CFileItem | ||
\sa CFileItem | ||
*/ | ||
typedef std::vector<CFileItem*> VECFILEITEMS; | ||
|
||
/* | ||
\brief A map of pointers to CFileItem | ||
\sa CFileItem | ||
*/ | ||
typedef std::map<CStdString, CFileItem*> MAPFILEITEMS; | ||
|
||
/* | ||
\brief Pair for MAPFILEITEMS | ||
\sa MAPFILEITEMS | ||
*/ | ||
typedef std::pair<CStdString, CFileItem*> MAPFILEITEMSPAIR; | ||
|
||
/*! | ||
\brief Iterator for VECFILEITEMS | ||
\sa CFileItemList | ||
*/ | ||
typedef std::vector<CFileItem*>::iterator IVECFILEITEMS; | ||
|
||
class CFileItemList : public CFileItem | ||
{ | ||
public: | ||
CFileItemList(); | ||
CFileItemList(const CStdString& strPath); | ||
virtual ~CFileItemList(); | ||
|
||
CFileItem* operator[] (int iItem); | ||
|
||
void Clear(); | ||
CFileItem* Get(int iItem); | ||
void Add(CFileItem* pItem); | ||
int Size() const; | ||
|
||
private: | ||
VECFILEITEMS m_items; | ||
MAPFILEITEMS m_map; | ||
}; | ||
|
||
#endif //H_CFILEITEM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include "..\..\utils\stdafx.h" | ||
#include "..\..\utils\Stdafx.h" | ||
#include "DVDClock.h" | ||
#include <math.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#include "HDDirectory.h" | ||
#include "..\utils\Stdafx.h" | ||
#include "..\utils\URIUtils.h" | ||
|
||
using namespace XFILE; | ||
|
||
CHDDirectory::CHDDirectory(void) | ||
{ | ||
} | ||
|
||
CHDDirectory::~CHDDirectory(void) | ||
{ | ||
} | ||
|
||
bool CHDDirectory::GetDirectory(const CStdString& strPath1, CFileItemList &items) | ||
{ | ||
WIN32_FIND_DATA wfd; | ||
HANDLE hFind; | ||
|
||
CStdString strPath=strPath1; | ||
CStdString strRoot = strPath; | ||
|
||
memset(&wfd, 0, sizeof(wfd)); | ||
URIUtils::AddSlashAtEnd(strRoot); | ||
strRoot.Replace("/", "\\"); | ||
|
||
CStdString strSearchMask = strRoot; | ||
strSearchMask += "*.*"; | ||
|
||
hFind = FindFirstFile(strSearchMask.c_str(), &wfd); | ||
|
||
if (INVALID_HANDLE_VALUE == hFind) | ||
return false; | ||
|
||
// List all the files in the directory with some info about them. | ||
do | ||
{ | ||
if (wfd.cFileName[0] != 0) | ||
{ | ||
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) | ||
{ | ||
CStdString strLabel=wfd.cFileName; | ||
CFileItem* pItem(new CFileItem(strLabel)); | ||
CStdString itemPath = strRoot + wfd.cFileName; | ||
pItem->m_bIsFolder = true; | ||
URIUtils::AddSlashAtEnd(itemPath); | ||
pItem->SetPath(itemPath); | ||
// FileTimeToLocalFileTime(&wfd.ftLastWriteTime, &localTime); //TODO | ||
// pItem->m_dateTime=localTime; //TODO | ||
|
||
items.Add(pItem); | ||
} | ||
else | ||
{ | ||
CStdString strLabel=wfd.cFileName; | ||
CFileItem* pItem(new CFileItem(strLabel)); | ||
CStdString itemPath = strRoot + wfd.cFileName; | ||
pItem->SetPath(itemPath); | ||
pItem->m_bIsFolder = false; | ||
// pItem->m_dwSize = CUtil::ToInt64(wfd.nFileSizeHigh, wfd.nFileSizeLow); //TODO | ||
// FileTimeToLocalFileTime(&wfd.ftLastWriteTime, &localTime); //TODO | ||
// pItem->m_dateTime=localTime; //TODO | ||
|
||
items.Add(pItem); | ||
} | ||
} | ||
} | ||
while (FindNextFile(hFind, &wfd) != 0); | ||
|
||
FindClose(hFind); | ||
|
||
return true; | ||
} | ||
|
||
bool CHDDirectory::Exists(const char* strPath) | ||
{ | ||
if (!strPath || !*strPath) | ||
return false; | ||
|
||
CStdString strReplaced=strPath; | ||
// g_charsetConverter.utf8ToStringCharset(strReplaced); //TODO | ||
|
||
strReplaced.Replace("/","\\"); | ||
|
||
URIUtils::AddSlashAtEnd(strReplaced); | ||
|
||
DWORD attributes = GetFileAttributes(strReplaced.c_str()); | ||
|
||
if (FILE_ATTRIBUTE_DIRECTORY & attributes) | ||
return true; | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef H_CHDDDIRECTORY | ||
#define H_CHDDDIRECTORY | ||
|
||
#include "..\utils\StdString.h" | ||
#include "..\FileItem.h" | ||
|
||
namespace XFILE | ||
{ | ||
|
||
class CHDDirectory | ||
{ | ||
public: | ||
CHDDirectory(void); | ||
~CHDDirectory(void); | ||
|
||
bool GetDirectory(const CStdString& strPath, CFileItemList &items); | ||
bool Exists(const char* strPath); | ||
}; | ||
|
||
} | ||
|
||
#endif //H_CHDDDIRECTORY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.