| 208 | } |
| 209 | |
| 210 | int NppFTP::LoadSettings() { |
| 211 | int result = 0; |
| 212 | |
| 213 | char xmlPath[MAX_PATH]; |
| 214 | char * utf8Store = SU::TCharToCP(m_configStore, CP_ACP); |
| 215 | strcpy(xmlPath, utf8Store); |
| 216 | ::PathCombineA(xmlPath, utf8Store, "NppFTP.xml"); |
| 217 | |
| 218 | TiXmlDocument settingsDoc = TiXmlDocument(xmlPath); |
| 219 | settingsDoc.LoadFile(); |
| 220 | |
| 221 | strcpy(xmlPath, utf8Store); |
| 222 | ::PathCombineA(xmlPath, utf8Store, "Certificates.xml"); |
| 223 | SU::FreeChar(utf8Store); |
| 224 | |
| 225 | TiXmlDocument certificatesDoc = TiXmlDocument(xmlPath); |
| 226 | certificatesDoc.LoadFile(); |
| 227 | |
| 228 | TiXmlElement* ftpElem = settingsDoc.FirstChildElement("NppFTP"); |
| 229 | if (!ftpElem) { |
| 230 | result = 1; |
| 231 | return result; |
| 232 | } |
| 233 | |
| 234 | m_ftpSettings->LoadSettings(ftpElem); |
| 235 | |
| 236 | TiXmlElement * profilesElem = ftpElem->FirstChildElement(FTPProfile::ProfilesElement); |
| 237 | if (!profilesElem) { |
| 238 | m_profiles.clear(); |
| 239 | result = 1; |
| 240 | } else { |
| 241 | m_profiles = FTPProfile::LoadProfiles(profilesElem); |
| 242 | for(size_t i = 0; i < m_profiles.size(); i++) { |
| 243 | m_profiles.at(i)->AddRef(); |
| 244 | m_profiles.at(i)->SetCacheParent(m_ftpSettings->GetGlobalCache()); |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | |
| 249 | ftpElem = certificatesDoc.FirstChildElement("NppFTP"); |
| 250 | if (!ftpElem) { |
| 251 | m_certificates.clear(); |
| 252 | result = 1; |
| 253 | } else { |
| 254 | TiXmlElement * dersElem = ftpElem->FirstChildElement(SSLCertificates::DERsElem); |
| 255 | if (!dersElem) { |
| 256 | m_certificates.clear(); |
| 257 | result = 1; |
| 258 | } else { |
| 259 | vDER derVect = SSLCertificates::LoadDER(dersElem); |
| 260 | m_certificates = SSLCertificates::ConvertDERVector(derVect); |
| 261 | SSLCertificates::FreeDERVector(derVect); |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | return result; |
| 266 | } |
| 267 |
nothing calls this directly
no test coverage detected