示例#1
0
  void ArgumentException::UpdateMessage()
    {
    // Does parameter string have a value
    if(_paramName.Length() != 0)
      {

      System::Text::StringBuilder sb;
      sb.Append(_message);
      // Construct strings
      System::String nl(L"\r\n");     // Replace someday with environment new line;
      System::String pn(L"Parameter name: ");

      sb.Append(nl);
      sb.Append(pn);
      sb.Append(_paramName);

      _message = sb.ToString();
      }
    }
示例#2
0
  // Default constructor
  WinException::WinException(cstring message, ulong err)
    :Exception(message)
    ,_err(err)
    {
     using namespace System;
    // Allocate buffer
    CharArray buffer(max_lib_buffer_size + 1);
    ulong retval = ::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS
                                  ,0, _err, 0, buffer.ToPtr(), max_lib_buffer_size, nullptr);

    if(retval != 0)
      {
      System::Text::StringBuilder sb;
      buffer[retval - 2] = L'\0';
      String temp(L"[");
      sb.Append(temp);
      sb.Append(buffer.ToConstPtr());
      sb.Append(L"]");
      sb.Append(L" - ");
      sb.Append(_message);
      _message = sb.ToString();
      }
    }
CJMCube::CJMCube(String * dir, Graphics * gr) : m_dir(dir), m_gr(gr)
	{
	Random *	rnd      = new Random();     // Random number generator
	System::Text::StringBuilder * sb = new System::Text::StringBuilder(S"");
	m_seedList = new Bitmap *[NUM_FACES];

	sb->Append(m_dir);
	sb->Append("Face1.bmp");
	m_seedList[0] = new Bitmap(sb->ToString());

	sb->Length = 0;
	sb->Append(m_dir);
	sb->Append("Face2.bmp");
	m_seedList[1] = new Bitmap(sb->ToString());

	sb->Length = 0;
	sb->Append(m_dir);
	sb->Append("Face3.bmp");
	m_seedList[2] = new Bitmap(sb->ToString());

	sb->Length = 0;
	sb->Append(m_dir);
	sb->Append("Face4.bmp");
	m_seedList[3] = new Bitmap(sb->ToString());

	sb->Length = 0;
	sb->Append(m_dir);
	sb->Append("Face5.bmp");
	m_seedList[4] = new Bitmap(sb->ToString());

	sb->Length = 0;
	sb->Append(m_dir);
	sb->Append("Face6.bmp");
	m_seedList[5] = new Bitmap(sb->ToString());
			
	Int32	i;
	Int32	flawMode;
	Int32	rotation;

	// Randomly reorient the faces of the seed input faces

	for (i = 0; i < NUM_SEED; i++)
		{
		rotation = (static_cast<Int32> (96 * rnd->NextDouble())) % NUM_MODES;
		switch (rotation)
			{
			default:
				break;
			}
		}
	
	// Randomly insert different mismatch modes

	for (i = 0; i < NUM_CHOICES; i++)
		{
		flawMode = (static_cast<Int32> (96 * rnd->NextDouble())) % NUM_MODES;
		switch (flawMode)
			{
			default:
				break;
			}
		}

	ConstructUnfoldedView(800, 20);
	}