Пример #1
0
	CmdBuildOptionsWindow(const String& package, const String& method, const String& mainconfigparam, const String& output,
		int targetmode, int hydra1_threads, int linkmode, bool blitzbuild, bool createmap, bool verbosebuild) :
		cmdPackage(package), cmdMethod(method)
	{
		CtrlLayout(*this, t_("Command line options for building"));
		MinimizeBox().CloseBoxRejects();
		threads <<= hydra1_threads;
		threads.NotNull(false);
		cmdAssembly = GetVarsName();
		cmdBuildMode = (targetmode == 1 ? "r" : targetmode == 2 ? "1" : targetmode == 3 ? "2" : "d");
		if (mainconfigparam.GetCount()) {
			cmdMainConfig = mainconfigparam;
			cmdMainConfig.Replace(" ", ",");
			cmdMainConfig.Insert(0, " +");
		}
		if (blitzbuild) blitz <<= true;
		switch(linkmode) {
			case 1: shared <<= true;  break;
			case 2: sharedbuild <<= true; break;
		}
		exportproject <<= 0;
		map <<= createmap;
		verbose <<= verbosebuild;
		out <<= output;
		out.SetConvert(Single<PathConvert>());
		outoption <<= true;
		umk <<= true;

		rebuild.WhenAction = blitz.WhenAction = msgonfail.WhenAction = silent.WhenAction =
			map.WhenAction = verbose.WhenAction = makefile.WhenAction =
			savetargetdir.WhenAction = exportproject.WhenAction = umk.WhenAction =
			threads.WhenAction = out.WhenAction = outoption.WhenAction = THISBACK(GenerateCmd);
		shared.WhenAction = THISBACK(OnShared);
		sharedbuild.WhenAction << THISBACK(OnSharedBuild);
		btnCopy.WhenPush = callback(&cmd, &TextCtrl::Copy);
	}
Пример #2
0
	void _toString(Json* jsn,String& str,String& tab,bool readStyle){
		if(jsn->_type==json_null){
			str = L"null";
		}else if(jsn->_type==json_boolean){
			str = jsn->_boolValue?L"true":L"false";
		}else if(jsn->_type==json_integer){
			str.FromInt64(jsn->_intValue,10);
		}else if(jsn->_type==json_double){
			str.Format(L"%#.16g",jsn->_doubleValue);
		}else if(jsn->_type==json_string){
			addSlash(jsn->_strValue->Handle(),jsn->_strValue->Length(),str,readStyle);
			str.Insert('"',0);
			str.Insert('"');
		}else if(jsn->_type==json_array){
			if(readStyle)
				str = L"[\r\n";
			else
				str = L"[";
			String sub;
			ObjectLink<Json>& a = *jsn->_arrayValue;
			a.First();
			Json* sjsn = a.Element();
			if(sjsn){
				if(readStyle)
					tab += L"\t";
				_toString(sjsn,sub,tab,readStyle);
				str += tab;
				str += sub;
				while(true){
					a.Move(1);
					sjsn = a.Element();
					if(!sjsn) break;
					_toString(sjsn,sub,tab,readStyle);
					if(readStyle)
						str += L",\r\n";
					else
						str += L",";
					str += tab;
					str += sub;
				}
				tab.Head(-1);
				if(readStyle)
					str += L"\r\n";
			}
			str += tab;
			str += L"]";
		}else if(jsn->_type==json_object){
			if(readStyle)
				str = L"{\r\n";
			else
				str = L"{";
			String sub;
			ObjectLink<Json::DICTION>& obj = *jsn->_objectValue;
			obj.First();
			Json::DICTION* dic = obj.Element();
			if(dic){
				if(readStyle){
					tab += L"\t";
					str += tab;
				}
				str += L"\"";
				addSlash(dic->key,dic->key.Length(),sub,readStyle);
				str += sub;
				if(readStyle){
					str += L"\" : ";
				}else{
					str += L"\":";
				}
				_toString(dic->val,sub,tab,readStyle);
				str += sub;
				while(true){
					obj.Move(1);
					dic = obj.Element();
					if(!dic) break;
					if(readStyle){
						str += L",\r\n";
						str += tab;
					}else{
						str += L",";
					}
					str += L"\"";
					addSlash(dic->key,dic->key.Length(),sub,readStyle);
					str += sub;
					if(readStyle){
						str += L"\" : ";
					}else{
						str += L"\":";
					}
					_toString(dic->val,sub,tab,readStyle);
					str += sub;
				}
				tab.Head(-1);
				if(readStyle)
					str += L"\r\n";
			}
			str += tab;
			str += L"}";
		}else if(jsn->_type==json_binary){
			Memory<char> code;
			int len = Base64::Encode(code,jsn->_binaryValue->Handle(),jsn->_binaryValue->Length());
			str.FromMultiByte((LPCSTR)code.Handle(),len);
			str.Insert('\'',0);
			str.Insert('\'');
		}
	}
Пример #3
0
void bigmailer::onSend()
{
	const String enter = "\r\n" ;
	if (messagePage.editor.IsModified())
		messagePage.Save() ;
	// mapa de los campos
	VectorMap<String, int> fldMap ;
	for (int i = 0; i < theDefList.fields.GetCount(); i++)
		fldMap.Add(theDefList.fields[i], i) ;

	String outHTML ;

	Index<String> css ;
	VectorMap<String, String> links ;
	String path = "./" ;
 	String html = EncodeHtml(messagePage.editor.Get(), css, links, path ) ;

	outHTML <<
		"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n"
		"<html>\r\n"
		"<head>\r\n"
		"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n"
		"<style>\r\n"
		<< AsCss( css ) << "\r\n"
		<< "</style>\r\n"
	     "</head>\r\n"
		   "<body>\r\n"
		<< html << "\r\n"
		<< "</body>\r\n"
		   "</html>\r\n" ;

	Progress prog ;
	prog.Set(0, theDefList.data.GetCount()) ;
	prog.Show() ;

	theDefList.errors.Clear() ;

	String theHtml ;
	for (int row = 0; row < theDefList.data.GetCount(); row++)
	{
		String addrTo = theDefList.data[row][1] ;
		if (addrTo.IsEmpty())
		{
			theDefList.errors.Add(t_("dirección incorrecta")) ;
			continue ;
		}

		if (prog.Canceled())
			break ;


		theHtml = outHTML ;

		String s = AsString(row+1) + " / " + AsString( theDefList.data.GetCount() ) ;
		prog.SetText(s) ;

		for (int i = 0; i < theDefList.fields.GetCount(); i++)
		{
			String toFind = "[%" + theDefList.fields[i] + "%]" ;
			int from = 0 ;
			while( (from = theHtml.Find(toFind, from )) != -1)
			{
				theHtml.Remove( from, toFind.GetCount() ) ;
				theHtml.Insert( from, theDefList.data[row][ fldMap.Get(theDefList.fields[i])] ) ;
			}
		}

		prog.SetPos(row+1) ;

		SmtpMailEx mail ;

		mail.Host( theCfg.smtpServer )
				.User( theCfg.user )
				.Password( theCfg.pass )
				.From( theMsg.from )
				.ReplyTo( theMsg.from )
				.To( addrTo )
				.Subject( theMsg.subject )
				.Text( "" )
		    .Attach("MENSAJE", theHtml, "text/html; charset=utf-8") ;

		if ( ! mail.Send() )
			theDefList.errors.Add(mail.GetError()) ;
		else
			theDefList.errors.Add("OK") ;

	}

	theDefList.Save() ;
}
Пример #4
0
void MakeBuild::SaveMakeFile(const String& fn, bool exporting)
{
	BeginBuilding(false, true);

	VectorMap<String, String> bm = GetMethodVars(method);
	One<Host> host = CreateHost(false);
	One<Builder> b = CreateBuilder(~host);
	
	if(!b)
		return;
	
	const TargetMode& tm = GetTargetMode();

	String makefile;

	Vector<String> uppdirs = GetUppDirs();
	String uppout = exporting ? host->GetHostPath(GetVar("OUTPUT")) : "_out/";
	String inclist;

	Index<String> allconfig = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam, *host, *b);
	bool win32 = allconfig.Find("WIN32") >= 0;

	Workspace wspc;
	wspc.Scan(GetMain(), allconfig.GetKeys());

	for(int i = 1; i < wspc.GetCount(); i++) {
		Index<String> modconfig = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b);
		for(int a = allconfig.GetCount(); --a >= 0;)
			if(modconfig.Find(allconfig[a]) < 0)
				allconfig.Remove(a);
	}

	if(!exporting)
		for(int i = 0; i < uppdirs.GetCount(); i++) {
			String srcdir = GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppdirs[i], ""))), win32);
			makefile << "UPPDIR" << (i + 1) << " = " << srcdir << "\n";
			inclist << " -I$(UPPDIR" << (i + 1) << ")";
		}
	else
		inclist << "-I./";
	Vector<String> includes = SplitDirs(bm.Get("INCLUDE",""));
	for(int i = 0; i < includes.GetCount(); i++)
		inclist << " -I" << includes[i];

	makefile << "\n"
		"UPPOUT = " << (exporting ? "_out/" : GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppout, ""))), win32)) << "\n"
		"CINC = " << inclist << "\n"
		"Macro = ";

	for(int i = 0; i < allconfig.GetCount(); i++)
		makefile << " -Dflag" << allconfig[i];
	makefile << "\n";

	String output, config, install, rules, linkdep, linkfiles, linkfileend;

	for(int i = 0; i < wspc.GetCount(); i++) {
		b->config = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b);
		b->version = tm.version;
		b->method = method;
		MakeFile mf;
		b->AddMakeFile(mf, wspc[i], GetAllUses(wspc, i),
		               GetAllLibraries(wspc, i, bm, mainconfigparam, *host, *b), allconfig,
		               exporting);
		if(!i) {
			String tdir = mf.outdir;
			String trg;
			if(tm.target_override) {
				trg = GetMakePath(AdjustMakePath(tm.target), win32);
				if(!trg.IsEmpty() && *trg.Last() == (win32 ? '\\' : '/'))
					trg << mf.outfile;
				else if(trg.Find(win32 ? '\\' : '/') < 0)
					trg.Insert(0, "$(OutDir)");
			}
			output = Nvl(trg, mf.output);
			if(exporting)
				output = wspc[i] + ".out";
			install << "\n"
				"OutDir = " << tdir << "\n"
				"OutFile = " << output << "\n"
				"\n"
				".PHONY: all\n"
				"all: prepare $(OutFile)\n"
				"\n"
				".PHONY: prepare\n"
				"prepare:\n";
		}
		config << mf.config;
		install << mf.install;
		rules << mf.rules;
		linkdep << mf.linkdep;
		linkfiles << mf.linkfiles;
		linkfileend << mf.linkfileend;
	}

	makefile
		<< config
		<< install
		<< "\n"
		"$(OutFile): " << linkdep << "\n\t" << linkfiles << linkfileend << " -Wl,--end-group\n\n"
		<< rules
		<< ".PHONY: clean\n"
		<< "clean:\n"
		<< "\tif [ -d $(UPPOUT) ]; then rm -rf $(UPPOUT); fi;\n";

	bool sv = ::SaveFile(fn, makefile);
	if(!exporting)
		if(sv)
			PutConsole(NFormat("%s(1): makefile generation complete", fn));
		else
			PutConsole(NFormat("%s: error writing makefile", fn));

	EndBuilding(true);
}
Пример #5
0
void CChat::Render( void )
{
	// Is the chat not visible?
	if( !m_bVisible )
		return;

	// Get the default font
	CGraphics * pGraphics = pCore->GetGraphics();

	// Calculate the render Y position
	float fCurrentY = m_fY;
	int iCurrentMessage = (MAX_CHAT_LINES - 1);

	// Loop over each chat line
	for( int i = 0; i < MAX_CHAT_LINES; i++ )
	{
		// Do we have a name?
		if( m_chatLine[iCurrentMessage - i].fNameExtent > 0.0f )
		{
			// Draw the player name
			pGraphics->DrawText( m_fX, fCurrentY, m_chatLine[iCurrentMessage - i].ulNameColour, 1.0f, "tahoma-bold", true, m_chatLine[iCurrentMessage - i].szName );

			// Draw the chat text
			pGraphics->DrawText( (m_fX + m_chatLine[iCurrentMessage - i].fNameExtent), fCurrentY, m_chatLine[iCurrentMessage - i].ulMsgColour, 1.0f, "tahoma-bold", true, m_chatLine[iCurrentMessage - i].szMessage );
		}
		else
		{
			// Draw the text
			pGraphics->DrawText( m_fX, fCurrentY, m_chatLine[iCurrentMessage - i].ulMsgColour, 1.0f, "tahoma-bold", true, m_chatLine[iCurrentMessage - i].szMessage );
		}

		// Increase the current offset
		fCurrentY += 16.0f;
	}

	// Is the input visible?
	if( m_bInputVisible )
	{
		// Calculate the input render position
		float fInputY = (m_fY + (16.0f * MAX_CHAT_LINES) + 10.0f);

		// Offset text cursor
		int iOffsetCursor = strlen("Say: ");

		// String for printing
		String strSay = String( "%s%s", "Say: ", m_strInput.Get() );

		//Is text select?
		if( m_iCountSelectedChars != 0 )
		{
			// Start select position
			int iStartPos = iOffsetCursor + m_iTextCursorPosition + ( m_iCountSelectedChars > 0 ? 0 : m_iCountSelectedChars);
			// End select position
			int iEndPos	  = iOffsetCursor + m_iTextCursorPosition + ( m_iCountSelectedChars > 0 ? m_iCountSelectedChars : 0 );
			
			// Split string
			String strFirst		= strSay.substr(0, iStartPos);
			String strMiddle	= strSay.substr(iStartPos, abs(m_iCountSelectedChars) );
			String strLast		= strSay.substr(iEndPos, strSay.GetLength() - iEndPos);

			// Substrings width
			float fStrFirstWidth = pGraphics->GetTextWidth(strFirst.Get(), 1.0f, "tahoma-bold");
			float fStrMiddleWidth = pGraphics->GetTextWidth(strMiddle.Get(), 1.0f, "tahoma-bold");

			// Draw first substring
			pGraphics->DrawText( m_fX, fInputY, D3DCOLOR_ARGB( 255, 255, 255, 255 ), 1.0f, "tahoma-bold", true, strFirst.Get() );

			// Draw select substring
			pGraphics->DrawBox(m_fX + fStrFirstWidth, fInputY, fStrMiddleWidth, 16.0f, D3DCOLOR_ARGB( 64, 0, 0, 255 ) );
			pGraphics->DrawText(m_fX + fStrFirstWidth, fInputY, D3DCOLOR_ARGB( 255, 128, 128, 128 ), 1.0f, "tahoma-bold", true, strMiddle.Get() );

			// Draw last substring
			float strLastStart_x = m_fX + fStrFirstWidth + fStrMiddleWidth;
			pGraphics->DrawText(strLastStart_x, fInputY, D3DCOLOR_ARGB( 255, 255, 255, 255 ), 1.0f, "tahoma-bold", true, strLast.Get() );
		}
		else
		{
			// Draw the input message
			strSay.Insert(m_iTextCursorPosition + iOffsetCursor, '|');
			pGraphics->DrawText( m_fX, fInputY, D3DCOLOR_ARGB( 255, 255, 255, 255 ), 1.0f, "tahoma-bold", true, strSay.Get() );
		}
	}
}
Пример #6
0
void __fastcall TMDIChild::actSendToPluginTestExecute(TObject *Sender)
{
    TMenuItem   *   curItem = (TMenuItem *)Sender;
    tagExePlugins   *   exePlug = m_Plugins->At(curItem->Tag);

    if(exePlug == NULL)
    {
        ShowMessage("actOpenPluginExecute index Error");
        return;
    }

    void * handle = FindWindow(exePlug->ClassName.c_str(), NULL);
    if(handle == NULL)
    {
        ShowMessage(FormatStr("没有开启%s!", exePlug->Name));
        return;
    }


    if(exePlug->RecvType == 0 || exePlug->RecvType == 2)
    {
        String hexStr;
        if(m_HexEditor->SelCount != 0)
        {
            hexStr = m_HexEditor->SelectionAsHex;

            for(int i=2; i<hexStr.Length(); i+=2)
            {
                hexStr.Insert(" ", i+1);
                i++;
            }
        }
        else
        {
            tagSelRect	selRect;
            if(GetTreeSelRect(selRect) == false)
                return;
            char	*pointer = m_HexEditor->GetFastPointer(0, m_HexEditor->DataSize);
            int pos = selRect.SelStart;
            int selSize = selRect.SelLength;
            hexStr = BinToStr(pointer+pos, selSize);
        }
        ///////////////////

        COPYDATASTRUCT	cds;
        cds.dwData = 0;
        cds.cbData = hexStr.Length();
        cds.lpData = (void *)hexStr.c_str();
        SendMessage(handle, WM_COPYDATA, 0, (long)&cds);
    }

    if(exePlug->RecvType == 1 || exePlug->RecvType == 2)
    {
        String info;
        if(m_ActiveFileStruct)
        {
            info = m_ActiveFileStruct->GetRemark();
        }
        else
        {
            info = "没有描述! 干!!";
        }
        COPYDATASTRUCT	cds;
        cds.dwData = 1;
        cds.cbData = info.Length();
        cds.lpData = (void *)info.c_str();
        SendMessage(handle, WM_COPYDATA, 0, (long)&cds);
    }
}
Пример #7
0
//---------------------------------------------------------------------------
bool __fastcall TXirconForm::ReadXircServers( TStringList *pSl )
{
  TRegistry * MyRegistry = new TRegistry();

  try
  {
    MyRegistry->RootKey = HKEY_CURRENT_USER;

    if ( !MyRegistry->OpenKey(RegKey, false) )
    {
      ShowMessage("Registry key specified does not exist: ReadXircServers()");
      return false; // if no key, quit
    }

    // Get Info structure
    TRegKeyInfo rki;
    if ( !MyRegistry->GetKeyInfo( rki ) )
    {
      ShowMessage("Unable to read registry key info: ReadXircServers()");
      return false;
    }

    // We handle 001 to 999 (000 is Default)
    if ( rki.NumValues > 999 )
    {
      ShowMessage("XiRCON Server list is full: ReadXircServers()");
      return false;
    }

    String StrIdx;
    int RegIndex = 1;

    for ( int ii = 0; ii < rki.NumValues && RegIndex < 1000 ; ii++ )
    {
      try
      {
        StrIdx = String( RegIndex );

        if ( RegIndex < 100 )
          StrIdx.Insert( "0", 1 );
        if ( RegIndex < 10 )
          StrIdx.Insert( "0", 1 );

        RegIndex++; // Do this prior to possibly throwing an exception!

        if ( MyRegistry->ValueExists( StrIdx ) )
          pSl->Add( MyRegistry->ReadString(StrIdx) );

      } catch(...) {
      }
    }
  }
  __finally
  {
    try {
      if ( MyRegistry )
        MyRegistry->CloseKey();
    } catch(...) {
    }
    try {
      if ( MyRegistry )
        delete MyRegistry;
    } catch(...) {
    }
  }

  if ( pSl->Count )
    return true;

  return false;
}