示例#1
0
    int PROCCALL initialize(int const logLevel, int const workThreadsCount)
    {
        TRY

        int refcnt = -1;
        MtQueue::MtQueueManager::initialize(MtQueue::MtQueueManager::IF_CREATE, NULL, &refcnt);
        if (refcnt != 1) {
            // decrement ref count
            MtQueue::MtQueueManager::initialize(MtQueue::MtQueueManager::IF_FREE);

            // raise exception
            THROW(CppUtils::OperationFailed, "exc_OnlySingleSCriptAllowed", "ctx_init", "");
        }

        MtQueue::MtQueueManager* ppProxymanager = NULL;
        MtQueue::MtQueueManager::initialize(MtQueue::MtQueueManager::IF_RESOLVE, &ppProxymanager);
        if (ppProxymanager)	{
            ppProxymanager->startup(workThreadsCount, QUEUE_MAX_CAPACITY, logLevel);
            //ppProxymanager->signRequest("nonce=1389213856&method=getInfo", "f6e7296cfc05d47707dd4f7984c022be3e5d2125e064da9a0bdc135c73d19f0f");
        }
        else
            THROW(CppUtils::OperationFailed, "exc_InvalidProxyManagerPointer", "ctx_RESOLVE_INST_PTR", "");



        CATCH_ALL("initialize");

    }
/******************************************************************************
* ++
* Method name : CListLog::ReadFile()
* Description : Ham doc file
* Parameters : NULL
        
* Return values : NULL
*		
* --
*****************************************************************************/
void CListLog::ReadFile()
{
	m_listlog.clear();
	CString lpszString;	
	TRY
	{
		CStdioFile file(FILR_LOG, CFile::modeNoTruncate | CFile::modeRead| CFile::modeCreate);
		//Tien hanh quet tung dong trong file
		while(file.ReadString(lpszString)) // truyen du lieu vo lpszString
		{
			if(lpszString.GetLength() != 0)
			{
				CString lpszSender = lpszString;

				file.ReadString(lpszString);
				CString lpszReceiver = lpszString;

				file.ReadString(lpszString);
				CString lpszContent = lpszString;

				file.ReadString(lpszString);
				CString lpszDateTime = lpszString;

				CLog* plog = new CLog(lpszSender, lpszReceiver, lpszContent, lpszDateTime);
				m_listlog.push_back(plog);
			}
		}
		file.Close();
	}
	CATCH_ALL(e);
	{
	}
	END_CATCH_ALL
}
示例#3
0
    int PROCCALL	deinitialize()
    {
        TRY
        MtQueue::MtQueueManager::initialize(MtQueue::MtQueueManager::IF_FREE);


        CATCH_ALL("deinitialize");
    }
示例#4
0
    int PROCCALL pushRemoveImmediately(char const* url, char const* data, char const* filename, int repeatCount)
    {
        TRY
        MtQueue::DataToSend data_packet;
        MtQueue::FileDataEntry fe(filename, data, url);

        data_packet.initialize(fe, MtQueue::DataToSend::LTF_RemoveImmediately, repeatCount);

        MtQueue::MtQueueManager* ppProxymanager = NULL;
        MtQueue::MtQueueManager::initialize(MtQueue::MtQueueManager::IF_RESOLVE, &ppProxymanager);
        if (ppProxymanager)
            ppProxymanager->push( data_packet );
        else
            THROW(CppUtils::OperationFailed, "exc_InvalidProxyManagerPointer", "ctx_RESOLVE_INST_PTR", "");


        CATCH_ALL("pushRemoveImmedaitely");
    }
示例#5
0
    int PROCCALL	rbt_getInfo(MqlStr* outData, char const* key, char const* secret)
    {
        TRY


        CppUtils::String result;

        MtQueue::MtQueueManager* ppProxymanager = NULL;
        MtQueue::MtQueueManager::initialize(MtQueue::MtQueueManager::IF_RESOLVE, &ppProxymanager);
        if (ppProxymanager)
            result = ppProxymanager->rbt_getInfo(key, secret);
        else
            THROW(CppUtils::OperationFailed, "exc_InvalidProxyManagerPointer", "ctx_RESOLVE_INST_PTR", "");


        if (!MtQueue::MqlStrHelper::copy(outData, result.c_str()))
            THROW(CppUtils::OperationFailed, "exc_NonSufficientStringBuffer_Server", "ctx_rbt_getInfo", "");


        CATCH_ALL("rbt_getInfo");
    }
示例#6
0
LayerModel::LayerModel()
{
  g_assert(!_singleton);
  _singleton  = this;

  try
  {
    pb_visible   = Gdk::Pixbuf::create_from_file(apply_filename_macros("$(exe-share)/icons/scalable/visible-layer.svg"));
    pb_invisible = Gdk::Pixbuf::create_from_file(apply_filename_macros("$(exe-share)/icons/scalable/invisible-layer.svg"));
  }CATCH_ALL("**LayerModel::LayerModel**", NOTHING_MACRO)

  gtk_tree_model  = Gtk::ListStore::create(columns());

  register_base_texture_layer();
  register_night_texture_layer();
  register_weight_texture_layer();
  register_cloud_texture_layer();
  register_atmosphere_layer();
  register_ring_layer();
  for(gsize i=0; i<N_LIGHT_LAYERS; ++i)
    register_light_layer(i);
}
示例#7
0
WarningListDialog::WarningListDialog()
{
  set_title(_("Warning"));

  g_assert(get_vbox());
  get_vbox()->pack_start(scrolled);

  scrolled.set_border_width(LENGTH_BORDER_WIDTH);

  scrolled.add(warnings);
  scrolled.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS);

  warnings.set_border_width(LENGTH_SMALLSPACE);

  try
  {
    warning_icon  = Gdk::Pixbuf::create_from_file(apply_filename_macros("$(exe-share)/icons/scalable/dialog-warning.svg"), 22, 22);
  }CATCH_ALL("**WarningListDialog::WarningListDialog**", NOTHING_MACRO);

  set_default_size(320, 480);

  show_all_children();
}
示例#8
0
void CWedDoc::Serialize(CArchive& ar, const char *docname)

{
    CString 	num, str;
    CString 	filename = docname;

    PathToFname(filename);

    if (ar.IsStoring())
    	{
		// Writing
		CWaitCursor cursor;

        POSITION pos;
		pos = strlist.GetHeadPosition();
		origlines = 0;
        while(TRUE)
        	{
        	CString line;
			if(!(origlines % 100))
				{
				num.Format("Writing %s line %d", filename, origlines);
				message(num);
				}
			origlines++;
            if (!pos)
            	break;

            line = strlist.GetNext(pos);

            // Obey tab save option
			if(Tab2Space ||	spaceify)
				ExpandTabs(line);

            // Dispose space from EOL
			line.TrimRight();

            // Write out to file
            ar.WriteString(line);

            // Do end of line according to settings
			if(unix)
				ar.WriteString("\n");
			else
				ar.WriteString("\r\n");
        	}
		num.Format("Wrote %s", filename);  message(num);

		// If user decides to save, save undo/redo info as well
		SaveUndo(); SaveRedo();
    	}
    else
    	{
		// Reading
		CWaitCursor cursor;
		char buff[DETECTSIZE];

        strlist.RemoveAll();

		// Determine file type
		CFile* fp = ar.GetFile();
		int rlen = fp->Read(buff, DETECTSIZE);

		// File without a newline ---> default to DOS
		if(!strstr(buff, "\n"))
			unix = FALSE;
		else if (strstr(buff, "\r\n"))
			unix = FALSE;
		else
			unix = TRUE;

		// Take a wild guess for tabs
		if(!strstr(buff, "\t") && rlen > DETECTSIZE/2 )
			{
			spaceify = TRUE;
			}

		// Start over on file
		fp->Seek(0,CFile::begin);
		origlines = 0;

		// Load file
        while(TRUE)
        	{
            str = "";
			if(!(origlines % 100))
				{
				CString num;
				num.Format("Reading %s line %d", filename, origlines);
				message(num);
				}
			if(YieldToWinEx())
				{
				readonly = TRUE;
				AfxMessageBox("Aborted load, partial buffer is readonly.");
				break;
				}
			TRY
            	{
            	if(!ar.ReadString(str))
                	break;
            	}
	        	CATCH_ALL(ee); END_CATCH_ALL
			origlines++;
            TRY
            	{
            	strlist.AddTail(str);
            	}
            	CATCH(CMemoryException, ee)
            		{
                	//P2N("Memory exception\r\n");
					break;
            		}
            	END_CATCH
        	}

		// So unix can see an unlocked file
		// Let others see it
		// ReleaseFile(fp, 1);

        // Patch things up
        if( strlist.IsEmpty())
        	{
            //P2N("Empty file\r\n");
            strlist.AddTail("");
        	}
    }
}