ctr_Repair/trunk/ConsoleDataMigration/sources/ConsoleRestore/XmlCreator.cpp
N2614 b4b01e1c1e XML生成部分を分離
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@568 385bec56-5757-e545-9c3a-d8741f4650f1
2012-01-18 07:56:39 +00:00

85 lines
2.5 KiB
C++

/*---------------------------------------------------------------------------*
Project: Horizon
File: XmlCreator.cpp
Copyright 2009-2011 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Rev$
*---------------------------------------------------------------------------*/
#include "XmlCreator.h"
#include <cstring>
#include <sstream>
namespace ConsoleRestore
{
namespace
{
const char xmlDataPrefix[] = \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
<SOAP-ENV:Envelope xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns0=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns2=\"urn:bgs.wsapi.broadon.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n\
<SOAP-ENV:Header/>\n\
<ns1:Body>\n\
<ns2:GetPreInstalledInfo>\n\
<ns2:GetPreInstalledInfo>\n\
<ns2:Version/>\n\
<ns2:MessageId/>\n";
const char xmlDeviceIdPrefix[] = \
" <ns2:DeviceId>";
const char xmlDeviceIdSuffix[] = "</ns2:DeviceId>\n";
const char xmlSerialNoPrefix[] = \
" <ns2:SerialNo>";
const char xmlSerialNoSuffix[] = "</ns2:SerialNo>\n";
const char xmlDataSuffix[] = \
" </ns2:GetPreInstalledInfo>\n\
</ns2:GetPreInstalledInfo>\n\
</ns1:Body>\n\
</SOAP-ENV:Envelope>";
}
XmlCreator::XmlCreator()
{
// TODO 自動生成されたコンストラクター・スタブ
}
XmlCreator::~XmlCreator()
{
// TODO Auto-generated destructor stub
}
void XmlCreator::Exec(bit64 deviceId, u8* serialNo)
{
m_Xml.append(xmlDataPrefix);
m_Xml.append(xmlDeviceIdPrefix);
std::ostringstream oss;
oss << std::dec;
oss << deviceId;
m_Xml.append(oss.str());
m_Xml.append(xmlDeviceIdSuffix);
m_Xml.append(xmlSerialNoPrefix);
m_Xml.append(reinterpret_cast<char*>(serialNo));
m_Xml.append(xmlSerialNoSuffix);
m_Xml.append(xmlDataSuffix);
}
std::string XmlCreator::GetData()
{
return m_Xml;
}
} /* namespace ConsoleRestore */