MCPcopy Create free account
hub / github.com/Scobalula/Greyhound / Load

Method Load

src/External/CascLib/src/CascRootFile_Text.cpp:52–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 }
51
52 DWORD Load(TCascStorage * hs, LPBYTE pbRootFile, size_t cbRootFile)
53 {
54 PCASC_CKEY_ENTRY pCKeyEntry;
55 CASC_CSV Csv(0, false);
56 BYTE CKey[MD5_HASH_SIZE];
57 DWORD dwErrCode;
58
59 // Parse the ROOT file first in order to see whether we have the correct format
60 dwErrCode = Csv.Load(pbRootFile, cbRootFile);
61 if(dwErrCode == ERROR_SUCCESS)
62 {
63 // Parse all lines
64 while(Csv.LoadNextLine())
65 {
66 const CASC_CSV_COLUMN & FileName = Csv[CSV_ZERO][CSV_ZERO];
67 const CASC_CSV_COLUMN & CKeyStr = Csv[CSV_ZERO][1];
68
69 // Convert the CKey to binary
70 if(BinaryFromString(CKeyStr.szValue, MD5_STRING_SIZE, CKey) == ERROR_SUCCESS)
71 {
72 // Verify whether it is a known entry
73 if((pCKeyEntry = FindCKeyEntry_CKey(hs, CKey)) != NULL)
74 {
75 // Insert the FileName+CKey to the file tree
76 FileTree.InsertByName(pCKeyEntry, FileName.szValue);
77 }
78 }
79 }
80 }
81
82 return dwErrCode;
83 }
84};
85
86//-----------------------------------------------------------------------------

Callers 2

IsRootFileMethod · 0.45

Calls 4

BinaryFromStringFunction · 0.85
FindCKeyEntry_CKeyFunction · 0.85
LoadNextLineMethod · 0.80
InsertByNameMethod · 0.80

Tested by

no test coverage detected