MkStr MkSystemEnvironment::GetCurrentSystemDate(void) const
{
    wchar_t dateBuf[9];
    _wstrdate_s(dateBuf, 9);
    MkStr tmpBuffer = dateBuf;

    // "월/일/연" -> "연.월.일"
    MkStr month, day, year;
    unsigned int pos = tmpBuffer.GetFirstBlock(0, L"/", month);
    pos = tmpBuffer.GetFirstBlock(pos, L"/", day);
    tmpBuffer.GetSubStr(MkArraySection(pos), year);

    MkStr result;
    result.Reserve(10);
    result += L"20";
    result += year;
    result += L".";
    result += month;
    result += L".";
    result += day;
    return result;
}
Example #2
0
	virtual bool SetUp(MkDataNode& sharingNode)
	{
		// [ data 형태 정의 ]
		//------------------------------------------------------------------------------------------------//
		// int a;
		// float b;
		// MkVec3 c;
		// wchar_t d[64];
		//------------------------------------------------------------------------------------------------//

		// srcArray 생성
		MkInterfaceForDataWriting dwInterface;
		dwInterface.SetInputSize(ePDT_Int, SIZE_COUNT);
		dwInterface.SetInputSize(ePDT_Float, SIZE_COUNT);
		dwInterface.SetInputSize(ePDT_Vec3, SIZE_COUNT);
		dwInterface.SetInputSize(ePDT_Str, SIZE_COUNT);
		dwInterface.UpdateInputSize();

		for (int i=0; i<SIZE_COUNT; ++i)
		{
			float f = static_cast<float>(i);

			dwInterface.Write(static_cast<int>(i));
			dwInterface.Write(static_cast<float>(f * -10.f));
			dwInterface.Write(MkVec3(f, f * -2.f, f * 3.f));
			dwInterface.Write(MkStr(L"잘생겨서 죄송요~"));
		}

		MkByteArray srcArray;
		dwInterface.Flush(srcArray);
		dwInterface.Clear();

		// srcArray -> 파일로 출력
		MkInterfaceForFileWriting fwInterface;
		fwInterface.SetUp(L"test.data", true, true);
		fwInterface.Write(srcArray, MkArraySection(0));
		fwInterface.Clear();

		srcArray.Clear();
		
		// 파일을 destBuffer에 읽음
		MkByteArray destBuffer;
		MkInterfaceForFileReading frInterface;
		frInterface.SetUp(L"test.data");
		frInterface.Read(destBuffer, MkArraySection(0));
		frInterface.Clear();

		MK_DEV_PANEL.MsgToLog(MkStr::EMPTY); // 빈 칸 하나 넣고,

		// 읽어들인 결과 출력. 첫번째와 마지막 unit 대상
		MkInterfaceForDataReading drInterface;
		drInterface.SetUp(destBuffer, 0);

		for (int i=0; i<SIZE_COUNT; ++i)
		{
			int a = 0;
			drInterface.Read(a);

			float b = 0.f;
			drInterface.Read(b);

			MkVec3 c = MkVec3::Zero;
			drInterface.Read(c);

			MkStr d;
			drInterface.Read(d);

			if (i == 0)
			{
				MK_DEV_PANEL.MsgToLog(L"[ First unit ]");
				MK_DEV_PANEL.MsgToLog(L"   a : " + MkStr(a));
				MK_DEV_PANEL.MsgToLog(L"   b : " + MkStr(b));
				MK_DEV_PANEL.MsgToLog(L"   c : " + MkStr(c));
				MK_DEV_PANEL.MsgToLog(L"   d : " + MkStr(d));
			}
			else if (i == (SIZE_COUNT - 1))
			{
				MK_DEV_PANEL.MsgToLog(L"[ Last unit ]");
				MK_DEV_PANEL.MsgToLog(L"   a : " + MkStr(a));
				MK_DEV_PANEL.MsgToLog(L"   b : " + MkStr(b));
				MK_DEV_PANEL.MsgToLog(L"   c : " + MkStr(c));
				MK_DEV_PANEL.MsgToLog(L"   d : " + MkStr(d));
			}
		}

		destBuffer.Clear();

		// 출력 폴더 열기
		MkPathName::GetRootDirectory().OpenDirectoryInExplorer();

		return true;
	}