diff --git a/trunk/ConsoleDataMigration/sources/ConsoleRestore/BgsCommunicator.cpp b/trunk/ConsoleDataMigration/sources/ConsoleRestore/BgsCommunicator.cpp index e10c81f..0ed4c22 100644 --- a/trunk/ConsoleDataMigration/sources/ConsoleRestore/BgsCommunicator.cpp +++ b/trunk/ConsoleDataMigration/sources/ConsoleRestore/BgsCommunicator.cpp @@ -15,37 +15,9 @@ #include "BgsCommunicator.h" -#include -#include - namespace ConsoleRestore { -namespace -{ -const char xmlDataPrefix[] = \ -"\n\ -\n\ - \n\ - \n\ - \n\ - \n\ - \n\ - \n"; -const char xmlDeviceIdPrefix[] = \ -" "; -const char xmlDeviceIdSuffix[] = "\n"; -const char xmlSerialNoPrefix[] = \ -" "; -const char xmlSerialNoSuffix[] = "\n"; -const char xmlDataSuffix[] = \ -" \n\ - \n\ - \n\ -"; - -} - BgsCommunicator::BgsCommunicator() { @@ -57,31 +29,9 @@ BgsCommunicator::~BgsCommunicator() // TODO Auto-generated destructor stub } -void BgsCommunicator::CreateXml(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(serialNo)); - m_Xml.append(xmlSerialNoSuffix); - - m_Xml.append(xmlDataSuffix); -} - -std::string BgsCommunicator::GetXml() -{ - return m_Xml; -} - bool BgsCommunicator::Execute() { + nn::Result result; return false; } diff --git a/trunk/ConsoleDataMigration/sources/ConsoleRestore/BgsCommunicator.h b/trunk/ConsoleDataMigration/sources/ConsoleRestore/BgsCommunicator.h index 6b8c53e..48ee151 100644 --- a/trunk/ConsoleDataMigration/sources/ConsoleRestore/BgsCommunicator.h +++ b/trunk/ConsoleDataMigration/sources/ConsoleRestore/BgsCommunicator.h @@ -16,13 +16,7 @@ #ifndef BGSCOMMUNICATOR_H_ #define BGSCOMMUNICATOR_H_ -#include -#if defined(__ARMCC_VERSION) #include -#else -#include "test_common.h" -#endif - namespace ConsoleRestore { @@ -32,14 +26,6 @@ public: BgsCommunicator(); virtual ~BgsCommunicator(); - //! @brief プリインストール情報を取得するためのXMLを構築します - //! @param[in] deviceId デバイスID - //! @param[in] serialNo シリアルNo. - void CreateXml(bit64 deviceId, u8* serialNo); - - //! @brief 構築したXMLデータを取得します - std::string GetXml(); - //! @brief 構築したXMLを使ってBGSと通信します bool Execute(); @@ -50,9 +36,6 @@ public: //! @param[out] buf 通信結果を書き込むバッファ void GetBody(void* buf); -private: - std::string m_Xml; - }; } /* namespace ConsoleRestore */ diff --git a/trunk/ConsoleDataMigration/sources/ConsoleRestore/OMakefile b/trunk/ConsoleDataMigration/sources/ConsoleRestore/OMakefile index da9e6ce..ace98aa 100644 --- a/trunk/ConsoleDataMigration/sources/ConsoleRestore/OMakefile +++ b/trunk/ConsoleDataMigration/sources/ConsoleRestore/OMakefile @@ -32,6 +32,7 @@ SOURCES[] = Shop.cpp RegionIdModifier.cpp SimpleXmlPreprocessor.cpp + XmlCreator.cpp BgsCommunicator.cpp ../common/Util.cpp ../common/DrawSystemState.cpp diff --git a/trunk/ConsoleDataMigration/sources/ConsoleRestore/XmlCreator.cpp b/trunk/ConsoleDataMigration/sources/ConsoleRestore/XmlCreator.cpp new file mode 100644 index 0000000..50ccbb2 --- /dev/null +++ b/trunk/ConsoleDataMigration/sources/ConsoleRestore/XmlCreator.cpp @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------* + 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 +#include + +namespace ConsoleRestore +{ + +namespace +{ +const char xmlDataPrefix[] = \ +"\n\ +\n\ + \n\ + \n\ + \n\ + \n\ + \n\ + \n"; +const char xmlDeviceIdPrefix[] = \ +" "; +const char xmlDeviceIdSuffix[] = "\n"; +const char xmlSerialNoPrefix[] = \ +" "; +const char xmlSerialNoSuffix[] = "\n"; +const char xmlDataSuffix[] = \ +" \n\ + \n\ + \n\ +"; + +} + + +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(serialNo)); + m_Xml.append(xmlSerialNoSuffix); + + m_Xml.append(xmlDataSuffix); +} + +std::string XmlCreator::GetData() +{ + return m_Xml; +} + +} /* namespace ConsoleRestore */ diff --git a/trunk/ConsoleDataMigration/sources/ConsoleRestore/XmlCreator.h b/trunk/ConsoleDataMigration/sources/ConsoleRestore/XmlCreator.h new file mode 100644 index 0000000..ce8af93 --- /dev/null +++ b/trunk/ConsoleDataMigration/sources/ConsoleRestore/XmlCreator.h @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------* + Project: Horizon + File: XmlCreator.h + + 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$ + *---------------------------------------------------------------------------*/ + +#ifndef XMLCREATOR_H_ +#define XMLCREATOR_H_ + +#include + +#if defined(__ARMCC_VERSION) +#include +#else +#include "test_common.h" +#endif + + +namespace ConsoleRestore +{ + +class XmlCreator +{ +public: + XmlCreator(); + virtual ~XmlCreator(); + + //! @brief プリインストール情報を取得するためのXMLを構築します + //! @param[in] deviceId デバイスID + //! @param[in] serialNo シリアルNo. + void Exec(bit64 deviceId, u8* serialNo); + + //! @brief 構築したXMLデータを取得します + std::string GetData(); + +private: + std::string m_Xml; + +}; + +} /* namespace ConsoleRestore */ +#endif /* XMLCREATOR_H_ */ diff --git a/trunk/ConsoleDataMigration/sources/tests/googletest/OMakefile b/trunk/ConsoleDataMigration/sources/tests/googletest/OMakefile index f90b55e..20d2490 100644 --- a/trunk/ConsoleDataMigration/sources/tests/googletest/OMakefile +++ b/trunk/ConsoleDataMigration/sources/tests/googletest/OMakefile @@ -1 +1 @@ -.SUBDIRS: RegionIdModifier BgsCommunicator +.SUBDIRS: RegionIdModifier XmlCreator diff --git a/trunk/ConsoleDataMigration/sources/tests/googletest/RegionIdModifier/OMakefile b/trunk/ConsoleDataMigration/sources/tests/googletest/RegionIdModifier/OMakefile index 42de733..ed12add 100644 --- a/trunk/ConsoleDataMigration/sources/tests/googletest/RegionIdModifier/OMakefile +++ b/trunk/ConsoleDataMigration/sources/tests/googletest/RegionIdModifier/OMakefile @@ -4,21 +4,23 @@ INCLUDES[] += ../../../ConsoleRestore TARGET = testRegionIdModifier +TEST_TARGET = RegionIdModifier SRC_FILES[] = testRegionIdModifier testUtil RegionIdModifier +# テスト独自のスタブを使用する場合に定義する CXXFLAGS += -DPCTEST_USE_STUB # テストディレクトリ外にあるので独自ルールでビルド -RegionIdModifier$(EXT_OBJ): ../../../ConsoleRestore/RegionIdModifier.cpp +$(TEST_TARGET)$(EXT_OBJ): ../../../ConsoleRestore/$(TEST_TARGET).cpp $(CXX) $(CXXFLAGS) $(PREFIXED_INCLUDES) -c $< -.DEFAULT: RegionIdModifier$(EXT_OBJ) $(TARGET)$(EXE) +.DEFAULT: $(TEST_TARGET)$(EXT_OBJ) $(TARGET)$(EXE) -CXXProgram(testRegionIdModifier, $(SRC_FILES)) +CXXProgram($(TARGET), $(SRC_FILES)) .PHONY: clean test clean: diff --git a/trunk/ConsoleDataMigration/sources/tests/googletest/BgsCommunicator/OMakefile b/trunk/ConsoleDataMigration/sources/tests/googletest/XmlCreator/OMakefile similarity index 52% rename from trunk/ConsoleDataMigration/sources/tests/googletest/BgsCommunicator/OMakefile rename to trunk/ConsoleDataMigration/sources/tests/googletest/XmlCreator/OMakefile index 7416889..fef7974 100644 --- a/trunk/ConsoleDataMigration/sources/tests/googletest/BgsCommunicator/OMakefile +++ b/trunk/ConsoleDataMigration/sources/tests/googletest/XmlCreator/OMakefile @@ -3,19 +3,20 @@ INCLUDES[] += ../common ../../../ConsoleRestore -TARGET = testBgsCommunicator +TARGET = testXmlCreator +TEST_TARGET = XmlCreator SRC_FILES[] = - testBgsCommunicator - BgsCommunicator + testXmlCreator + XmlCreator # テストディレクトリ外にあるので独自ルールでビルド -BgsCommunicator$(EXT_OBJ): ../../../ConsoleRestore/BgsCommunicator.cpp +$(TEST_TARGET)$(EXT_OBJ): ../../../ConsoleRestore/$(TEST_TARGET).cpp $(CXX) $(CXXFLAGS) $(PREFIXED_INCLUDES) -c $< -.DEFAULT: BgsCommunicator$(EXT_OBJ) $(TARGET)$(EXE) +.DEFAULT: $(TEST_TARGET)$(EXT_OBJ) $(TARGET)$(EXE) -CXXProgram(testBgsCommunicator, $(SRC_FILES)) +CXXProgram($(TARGET), $(SRC_FILES)) .PHONY: clean test clean: diff --git a/trunk/ConsoleDataMigration/sources/tests/googletest/BgsCommunicator/testBgsCommunicator.cpp b/trunk/ConsoleDataMigration/sources/tests/googletest/XmlCreator/testXmlCreator.cpp similarity index 79% rename from trunk/ConsoleDataMigration/sources/tests/googletest/BgsCommunicator/testBgsCommunicator.cpp rename to trunk/ConsoleDataMigration/sources/tests/googletest/XmlCreator/testXmlCreator.cpp index f32114a..58d6872 100644 --- a/trunk/ConsoleDataMigration/sources/tests/googletest/BgsCommunicator/testBgsCommunicator.cpp +++ b/trunk/ConsoleDataMigration/sources/tests/googletest/XmlCreator/testXmlCreator.cpp @@ -1,7 +1,7 @@ #include #include -#include "BgsCommunicator.h" +#include "XmlCreator.h" using namespace ConsoleRestore; @@ -25,9 +25,9 @@ const char testStr[] = \ "; } -TEST(testBgsCommunicator, CreateXml) +TEST(testXmlCreator, Exec) { - BgsCommunicator comm; - comm.CreateXml(17179924184, reinterpret_cast(const_cast("EJA20305940"))); - ASSERT_STREQ(testStr, comm.GetXml().c_str()); + XmlCreator xml; + xml.Exec(17179924184, reinterpret_cast(const_cast("EJA20305940"))); + ASSERT_STREQ(testStr, xml.GetData().c_str()); }