Esempio n. 1
0
void ArchExecutor::DecodeFiles(Options* options)
{
	int filesCount = options->Files->GetCount();
	for(int i = 0; i < filesCount; i++)
	{
		char* path = options->Files->GetElement(i);
		FILE* inputFile = fopen(path, "rb");
		char* fileName = ReadFileName(inputFile);
		char filePath[PATH_MAX];
		strcpy(filePath, path);
		char* inputFileName = GetName(path);
		filePath[strlen(path) - strlen(inputFileName) - 1] = '\0';
		char decompressedPath[PATH_MAX];
		int pathLength = sprintf (decompressedPath, "%s/%s", filePath, fileName);
		if (pathLength >= PATH_MAX) 
		{
			printf ("Path length has got too long.\n");
			continue;
		}
		
		FILE* outputFile = fopen(decompressedPath, "wb");
		if (!IsCompressedFile(inputFile))
		{
			fclose(inputFile);
			continue;
		}

		LzwDecoder decoder(inputFile, outputFile);
		decoder.Decode();
		fclose(inputFile);
		remove(path);
	}
}
Esempio n. 2
0
bool  DPO_ReadXY::ReadFromFile()
{
    ReadObjectHeader();

    ReadFileName(xyFname);
    xyFileFormat = DSC_XYInputSpec::XYFileFormat(ReadInt());
    readColumnID = ReadBool();

    tableXcol = ReadInt();
    tableYcol = ReadInt();

    if (currentObjReadMajorVersion > 1)
    {
        dateSpec.timeSpecUnits = DC_DateTime::TimeUnits(ReadInt());
        dateSpec.timeSpecType = DC_DateTimeSpec::TimeSpecType(ReadInt());
        dateSpec.calendarYearStart = ReadInt();
    }

    ReadText(dataID, DC_XYData::dataIDLen);

    if (currentObjReadMajorVersion > 0)
        ReadNodeFileArray(mpiFiles);

    CheckForInputFailure("Reading DPO_ReadXY");
    return true;
}
Esempio n. 3
0
    // sets currObjReadMajorVersion & currObjReadMajorVersion
    void  ReadGroupHeader(const char*  headerToMatch, int  maxMajorVer)
    {
        char tempHeader[stdFileStrLen];
        static char errMsg[80];

        ReadFileName(tempHeader);
        if (strcmp(tempHeader, headerToMatch) != 0)
            {
                CopyString(errMsg, "Header read:  ", 80);
                ConcatString(errMsg, headerToMatch, 80);
                cfgObject->ThrowTextError(errMsg);
            }

        currentObjReadMajorVersion = ReadInt();
        currentObjReadMinorVersion = ReadInt();

        if (currentObjReadMajorVersion > maxMajorVer)
            {
                CopyString(errMsg, "Reading future version:  ", 80);
                ConcatString(errMsg, headerToMatch, 80);
                cfgObject->ThrowTextError(errMsg);
            }

        cfgObject->CheckTextError("Reading file header");
    }
Esempio n. 4
0
bool  DPO_ReadCurveArray::ReadFromFile()
{
    ReadObjectHeader();

    ReadFileName(curveArrayFname);

    CheckForInputFailure("Reading DPO_ReadCurveArray");
    return true;
}
Esempio n. 5
0
bool  DPO_ReadOptSimResults::ReadFromFile()
{
    ReadObjectHeader();

    ReadFileName(optSimResultsIO.fileName);

    CheckForInputFailure("Reading DPO_ReadOptSimResults");
    return true;
}
Esempio n. 6
0
bool  DPO_ReadLabelArray::ReadFromFile()
{
    ReadObjectHeader();
    ReadFileName(labelsFname);
    labelFileFormat = IO_LabelArray::LabelFileFormat(ReadInt());

    CheckForInputFailure("Reading DPO_ReadLabelArray");
    return true;
}
Esempio n. 7
0
bool  DPO_ExecuteProcess::ReadFromFile()
{
    ReadObjectHeader();

    ReadFileName(processToExecute);
    ReadFileName(processCmdLine);
    ReadFileName(processExeDirectory);

    useUpstreamTrigger = ReadBool();
    upstreamMustBeOK = ReadBool();
    if (currentObjReadMajorVersion > 0)
        executeOnApply = ReadBool(); // added v1
    if (currentObjReadMajorVersion > 3)
        ignoreGlobalDoNotExecute = ReadBool(); // added v4
    if (currentObjReadMajorVersion > 1)
        hideConsoleWindow = ReadBool(); // added v1

    useSpecificEXE = ReadBool();
    useCommandLine = ReadBool();
    if (currentObjReadMajorVersion > 0)
        addExePar0 = ReadBool(); // added v1

    setExeDirectory = ReadBool();

    if (currentObjReadMajorVersion > 2)
    {
        addMPINodeNumber = ReadBool();
        mpiFiles[0].nodeBasedFile = ReadBool();
        mpiFiles[1].nodeBasedFile = ReadBool();
        mpiFiles[2].nodeBasedFile = ReadBool();
    }

    ReadFuncObjRef(upstreamTriggerObjRef);

    CheckForInputFailure("Reading DPO_ExecuteProcess");
    return true;
}
Esempio n. 8
0
bool CInArchive::ReadLocalItem(CItemEx &item)
{
  const unsigned kPureHeaderSize = kLocalHeaderSize - 4;
  Byte p[kPureHeaderSize];
  SafeReadBytes(p, kPureHeaderSize);
  {
    unsigned i;
    for (i = 0; i < kPureHeaderSize && p[i] == 0; i++);
    if (i == kPureHeaderSize)
      return false;
  }

  item.ExtractVersion.Version = p[0];
  item.ExtractVersion.HostOS = p[1];
  item.Flags = Get16(p + 2);
  item.Method = Get16(p + 4);
  item.Time = Get32(p + 6);
  item.Crc = Get32(p + 10);
  item.PackSize = Get32(p + 14);
  item.Size = Get32(p + 18);
  unsigned nameSize = Get16(p + 22);
  unsigned extraSize = Get16(p + 24);
  ReadFileName(nameSize, item.Name);
  item.LocalFullHeaderSize = kLocalHeaderSize + (UInt32)nameSize + extraSize;

  /*
  if (item.IsDir())
    item.Size = 0; // check It
  */

  if (extraSize > 0)
  {
    UInt64 localHeaderOffset = 0;
    UInt32 diskStartNumber = 0;
    if (!ReadExtra(extraSize, item.LocalExtra, item.Size, item.PackSize,
        localHeaderOffset, diskStartNumber))
      return false;
  }
  if (!CheckDosTime(item.Time))
  {
    HeadersWarning = true;
    // return false;
  }
  if (item.Name.Len() != nameSize)
    return false;
  return item.LocalFullHeaderSize <= ((UInt32)1 << 16);
}
Esempio n. 9
0
HRESULT CInArchive::ReadCdItem(CItemEx &item)
{
  item.FromCentral = true;
  Byte p[kCentralHeaderSize - 4];
  SafeReadBytes(p, kCentralHeaderSize - 4);

  item.MadeByVersion.Version = p[0];
  item.MadeByVersion.HostOS = p[1];
  item.ExtractVersion.Version = p[2];
  item.ExtractVersion.HostOS = p[3];
  item.Flags = Get16(p + 4);
  item.Method = Get16(p + 6);
  item.Time = Get32(p + 8);
  item.Crc = Get32(p + 12);
  item.PackSize = Get32(p + 16);
  item.Size = Get32(p + 20);
  unsigned nameSize = Get16(p + 24);
  UInt16 extraSize = Get16(p + 26);
  UInt16 commentSize = Get16(p + 28);
  UInt32 diskNumberStart = Get16(p + 30);
  item.InternalAttrib = Get16(p + 32);
  item.ExternalAttrib = Get32(p + 34);
  item.LocalHeaderPos = Get32(p + 38);
  ReadFileName(nameSize, item.Name);

  if (extraSize > 0)
  {
    ReadExtra(extraSize, item.CentralExtra, item.Size, item.PackSize,
        item.LocalHeaderPos, diskNumberStart);
  }

  if (diskNumberStart != 0)
    return E_NOTIMPL;

  // May be these strings must be deleted
  /*
  if (item.IsDir())
    item.Size = 0;
  */

  ReadBuffer(item.Comment, commentSize);
  return S_OK;
}
Esempio n. 10
0
void ArchExecutor::ListCompressionInfo(Options* options)
{
	int filesCount = options->Files->GetCount();
	printf("compressed\t uncompressed: \t ratio\t  uncompressed_name\n");
	for(int i = 0; i < filesCount; i++)
	{
		FILE* file = fopen(options->Files->GetElement(i), "rb");
		char* filename = ReadFileName(file);
		unsigned long fileSize = ReadUncompressedSize(file);
		unsigned long compressedFileSize = GetLastFilePosition(file);
		printf("%lu\t\t %lu\t\t %f\t\t", compressedFileSize, fileSize, (double)fileSize/compressedFileSize);
		int j = 0;
		while (filename[j]!= '\0')
		{
			printf("%c", filename[j]);
			j++;
		}

		printf("\n");
		fclose(file);
	}
}
Esempio n. 11
0
bool  DPO_ReadGridData::ReadFromFile()
{
    ReadObjectHeader();

    ReadFileName(gridDataFname);

    if (currentObjReadMajorVersion > 0)
    {
        ReadText(setXID, DC_GridData::gridIDLen);
        ReadText(setYID, DC_GridData::gridIDLen);
        setXLog = ReadBool();
        setYLog = ReadBool();

        if (currentObjReadMajorVersion > 1)
            gridFileFormat = IO_GridData::GridFileFormat(ReadInt());

        if (currentObjReadMajorVersion > 2)
            decimationModulus = ReadInt();
    }

    CheckForInputFailure("Reading DPO_ReadGridData");
    return true;
}
Esempio n. 12
0
void CTuopList::refresh()
{
	bool bEnd = false;
	string strUserID = GetWebUserID();

	HitLog LogItem;
	LogItem.sUserName = strUserID;
	LogItem.sHitPro = "TuopList";
	LogItem.sHitFunc = "refresh";
	LogItem.sDesc = strRefresh;

	DWORD dcalBegin=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 0, 0);

OPEnd:
	if(bEnd)
	{
		DWORD dcalEnd=GetTickCount();
		InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 1, dcalEnd -dcalBegin);
		return;
	}

	if(bFirst)
	{
		bFirst =false;
		bEnd = true;	
		goto OPEnd;
	}

	m_pTopologyListTable->GeDataTable()->clear();
	RecordList.clear();

	pSortTable->GeDataTable()->clear();
	
	
	std::string strIndex;
	std::list<string> m_pList;
	std::list<string>::iterator m_pItem;

	#ifdef	 Tuopu
		m_pList = ReadFileName(GetSiteViewRootPath() + "\\htdocs\\tuoplist");		
	#else
		m_pList = ReadFileName(GetSiteViewRootPath() + "\\htdocs\\maintainlist");
	#endif

	std::list<string> m_pVList;
	std::list<string>::iterator m_pVItem;

	#ifdef	 Tuopu
		m_pVList = ReadVSDName(GetSiteViewRootPath() + "\\htdocs\\tuoplist");
	#else
		m_pVList = ReadVSDName(GetSiteViewRootPath() + "\\htdocs\\maintainlist");
	#endif
	
	m_pVItem = m_pVList.begin();	
	for(m_pItem = m_pList.begin(); m_pItem != m_pList.end(); m_pItem++)
	{
		std::string strUserName = *m_pItem;
		std::string strVSD = *m_pVItem; 
		OneRecord list;
		list.strUserName = strUserName;
		//vsd文件始终不会更改, 所以用它来制造key
		list.strBackName = ReplaceStdString(strVSD, ".vsd", ".htm");
		list.strTuop = strVSD;

		//读取tuopfile.ini的sort信息并赋值给OneRecord变量。:
		//如果没有预先设置的sort信息则按什么规则自动赋值? ---》先是读预先设置的序号, 为默认值 则不存在 意味着是新发布的 
		//---》规则(读一遍ini, 找到序号最大值, 加1 并写到tuopfile.ini文件中)
		int nSort = GetIniFileInt("sort", strVSD, -1, "tuopfile.ini");
		if(nSort != -1)
		{
			list.nSort = nSort;
		}
		else
		{
			//获取序号最大值, 加1
			list.nSort = GetMaxSortId() + 1;

			//写序号值到ini
		#ifdef	 Tuopu
			WriteIniFileInt("sort", strVSD, list.nSort, "tuopfile.ini");
		#else
			WriteIniFileInt("sort", strVSD, list.nSort, "maintainfile.ini");
		#endif
		}

		RecordList.push_back(list);

		m_pVItem++;
	}


	//显示列表
	int i = 1;
	std::string strOpen;

	for(m_pRecordList=RecordList.begin(); m_pRecordList != RecordList.end(); m_pRecordList ++)
	{
		m_pTopologyListTable->InitRow(i);
		pSortTable->InitRow(i);
		i++;
	}

	i = 1;
	for(m_pRecordList=RecordList.begin(); m_pRecordList != RecordList.end(); m_pRecordList ++)
	{
		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 0)->setContentAlignment(AlignCenter);
		m_pRecordList->pCheckBox = new WCheckBox("", (WContainerWidget*)m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 0));		

		strOpen = "<a href=./showtuopu.exe?pageid=";
		strOpen += ReplaceStdString(m_pRecordList->strBackName, ".htm", "");
	#ifdef	 Tuopu
		strOpen += "&version=0";
	#else
		strOpen += "&version=0&usrleader=0&maintain=1";
	#endif
		strOpen += " target=_blank>";
		strOpen += m_pRecordList->strUserName;
		strOpen += "</a>";

		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2)->setContentAlignment(AlignCenter);
		m_pRecordList->pstrUserName = new WText(strOpen, (WContainerWidget*)m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));
		
		m_pRecordList->pLineEdit = new WLineEdit(m_pRecordList->strUserName,m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));
		m_pRecordList->pLineEdit->hide();

		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4)->setContentAlignment(AlignCenter);		
		m_pRecordList->pTuop = new WImage("../Images/resource.gif",m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4));
		m_pRecordList->pTuop->setToolTip(strTuopTip);
		m_pRecordList->pTuop->setStyleClass("hand");

		//绑定visio事件
		std::string strJavascript;

	#ifdef	 Tuopu
		strJavascript = "window.open('../tuoplist/" + m_pRecordList->strTuop + "','newwindow')";	
	#else
		strJavascript = "window.open('../maintainlist/" + m_pRecordList->strTuop + "','newwindow')";	
	#endif

		connect(m_pRecordList->pTuop, SIGNAL(clicked()),strJavascript.c_str() ,WObject::JAVASCRIPT );

		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 6)->setContentAlignment(AlignCenter);
		m_pRecordList->pEdit = new WImage("/Images/edit.gif",m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 6));		
		m_pRecordList->pEdit->setToolTip(strEditTip);
		m_pRecordList->pEdit->setStyleClass("hand");
		
		strIndex=m_pRecordList->strUserName.c_str();

		m_userMapper.setMapping(m_pRecordList->pEdit, strIndex); 
		
		connect(m_pRecordList->pEdit, SIGNAL(clicked()), &m_userMapper, SLOT(map()));
		connect(m_pRecordList->pLineEdit, SIGNAL(keyWentDown(int)), this, SLOT(EditReturn(int)));
		i++;

		//排序界面初始化
		pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2)->setContentAlignment(AlignCenter);
		WText * pTmpText = new WText(m_pRecordList->strUserName, pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));
		
		char chItem[32]  = {0};	
		sprintf(chItem, "%d", m_pRecordList->nSort);
		string strSort = chItem;

		pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4)->setContentAlignment(AlignCenter);
		WLineEdit * pTmpEdit = new WLineEdit(strSort, pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4));

		//放到sv_table里去
		SVTableCell ce;
		ce.setType(adText);
		ce.setValue(pTmpText);
		m_svSortList.WriteCell(m_pRecordList->strTuop, 0, ce);

		ce.setType(adLineEdit);
		ce.setValue(pTmpEdit);
		m_svSortList.WriteCell(m_pRecordList->strTuop, 1, ce);
	}
	
	m_pList.clear();
	m_pVList.clear();
	
	//列表为空
	if(RecordList.size() <= 0)
	{
		m_pTopologyListTable->ShowNullTip();
	}
	else
	{
		m_pTopologyListTable->HideNullTip();
	}

	//可能有问题..
	pSortTable->hide();

	DWORD dcalEnd1=GetTickCount();
	InsertHitRecord(LogItem.sUserName, LogItem.sHitPro, LogItem.sHitFunc, LogItem.sDesc, 1, dcalEnd1 - dcalBegin);
}
Esempio n. 13
0
void CTuopList::ShowMainTable()
{
	//strNullList = "空的列表";

	m_pMainTable = new WSVMainTable(this,strMainTitle,false);
	//if(m_pMainTable->pHelpImg)
	//{
	//	connect(m_pMainTable->pHelpImg,SIGNAL(click()),this,SLOT(ShowHelp()));
	//}

	//拓扑列表界面
	m_pTopologyListTable = new WSVFlexTable(m_pMainTable->GetContentTable()->elementAt(0,0),List, strTitle);

	if (m_pTopologyListTable->GetContentTable() != NULL)
	{
		m_pTopologyListTable->AppendColumn("",WLength(40,WLength::Pixel));
		m_pTopologyListTable->SetDataRowStyle("table_data_grid_item_text");

		m_pTopologyListTable->AppendColumn(strLoginLabel,WLength(70,WLength::Percentage));
		m_pTopologyListTable->SetDataRowStyle("table_data_grid_item_text");

		m_pTopologyListTable->AppendColumn(strNameUse,WLength(10,WLength::Percentage));
		m_pTopologyListTable->SetDataRowStyle("table_data_grid_item_text");

		m_pTopologyListTable->AppendColumn(strNameEdit,WLength(10,WLength::Percentage));
		m_pTopologyListTable->SetDataRowStyle("table_data_grid_item_text");
	}

	if (m_pTopologyListTable->GetActionTable() != NULL)
	{
		m_pTopologyListTable->AddStandardSelLink(strAllSel ,strAllNotSel,strFanSel);
		connect(m_pTopologyListTable->pSelAll, SIGNAL(clicked()), this, SLOT(SelAll()));
		connect(m_pTopologyListTable->pSelNone, SIGNAL(clicked()), this, SLOT(SelNone()));
		connect(m_pTopologyListTable->pSelReverse, SIGNAL(clicked()), this, SLOT(SelInvert()));
	
		WTable *pTbl;
		m_pTopologyListTable->GetActionTable()->elementAt(0,1)->setContentAlignment(AlignCenter);
		m_pTopologyListTable->GetActionTable()->elementAt(0,1)->setStyleClass("textbold");
		
		pTbl = new WTable(m_pTopologyListTable->GetActionTable()->elementAt(0,1));
		pTbl->setStyleClass("widthauto");
		WSVButton * pDel = new WSVButton(pTbl->elementAt(0,1),strDelete, "button_bg_del.png", "", false);
		if (pDel)
		{
			connect(pDel, SIGNAL(clicked()), this, SLOT(BeforeDelUser()));
		} 

		//新增
		//WSVButton * pSort = new WSVButton(pTbl->elementAt(0,2), "排序", "button_bg_taxis.png", "", false);
		WSVButton * pSort = new WSVButton(pTbl->elementAt(0,2), strSort, "button_bg_taxis.png", "", false);
		if (pSort)
		{
			connect(pSort, SIGNAL(clicked()), this, SLOT(Sort()));
		}

		//WTable *pTbl2;
		m_pTopologyListTable->GetActionTable()->elementAt(0, 2)->setContentAlignment(AlignRight);		
		strcpy(m_pTopologyListTable->GetActionTable()->elementAt(0, 2)->contextmenu_, "nowrap");			

		//Tuopu 发布插件下载
		string strTuopPluginJs = "window.open('../TuopoClient.exe','newwindow')";
		
		string szLink = "<a href='#'>" + szTuopDown + "</a>&nbsp;&nbsp;";
		WText * pTuopPlugin = new WText(szLink, (WContainerWidget *)m_pTopologyListTable->GetActionTable()->elementAt(0, 2));
		connect(pTuopPlugin, SIGNAL(clicked()),strTuopPluginJs.c_str() ,WObject::JAVASCRIPT);
	}

	m_pTopologyListTable->SetNullTipInfo(strNullList);


	//拓扑排序列表界面
	//pSortTable = new WSVFlexTable(m_pMainTable->GetContentTable()->elementAt(1,0), List, "拓扑排序列表");
	pSortTable = new WSVFlexTable(m_pMainTable->GetContentTable()->elementAt(1,0), List, strTuoPuSortList);
	if (pSortTable->GetContentTable() != NULL)
	{
		pSortTable->AppendColumn("",WLength(40,WLength::Pixel));
		pSortTable->SetDataRowStyle("table_data_grid_item_text");

		//pSortTable->AppendColumn("名称",WLength(50,WLength::Percentage));
		pSortTable->AppendColumn(strName,WLength(50,WLength::Percentage));
		pSortTable->SetDataRowStyle("table_data_grid_item_text");

		//pSortTable->AppendColumn("序号",WLength(50,WLength::Percentage));
		pSortTable->AppendColumn(strSequenceNo,WLength(50,WLength::Percentage));
		pSortTable->SetDataRowStyle("table_data_grid_item_text");
	}

	if (pSortTable->GetActionTable() != NULL)
	{
		WTable *pTbl1;
		pSortTable->GetActionTable()->elementAt(0,1)->setContentAlignment(AlignCenter);
		pSortTable->GetActionTable()->elementAt(0,1)->setStyleClass("textbold");
		
		pTbl1 = new WTable(pSortTable->GetActionTable()->elementAt(0,1));
		pTbl1->setStyleClass("widthauto");
		//WSVButton * pSortOkBtn = new WSVButton(pTbl1->elementAt(0, 1), "确 定", "button_bg_m.png", "", false);
		WSVButton * pSortOkBtn = new WSVButton(pTbl1->elementAt(0, 1), strAffirm, "button_bg_m.png", "", false);

		if(pSortOkBtn)
		{
			connect(pSortOkBtn,SIGNAL(clicked()),this,SLOT(SortOk()));
		}
	}
	
	//编辑事件
	std::string strIndex;

	std::list<string> m_pList;
	std::list<string>::iterator m_pItem;

	#ifdef	 Tuopu
		m_pList = ReadFileName(GetSiteViewRootPath() + "\\htdocs\\tuoplist");		
	#else
		m_pList = ReadFileName(GetSiteViewRootPath() + "\\htdocs\\maintainlist");
	#endif

	std::list<string> m_pVList;
	std::list<string>::iterator m_pVItem;

	#ifdef	 Tuopu
		m_pVList = ReadVSDName(GetSiteViewRootPath() + "\\htdocs\\tuoplist");
	#else
		m_pVList = ReadVSDName(GetSiteViewRootPath() + "\\htdocs\\maintainlist");
	#endif

	m_pVItem = m_pVList.begin();	
	for(m_pItem = m_pList.begin(); m_pItem != m_pList.end(); m_pItem++)
	{
		std::string strUserName = *m_pItem;
		std::string strVSD = *m_pVItem; 
		OneRecord list;
		list.strUserName = strUserName;
		//vsd文件始终不会更改, 所以用它来制造key
		list.strBackName = ReplaceStdString(strVSD, ".vsd", ".htm");
		list.strTuop = strVSD;

		//读取tuopfile.ini的sort信息并赋值给OneRecord变量。:
		//如果没有预先设置的sort信息则按什么规则自动赋值? ---》先是读预先设置的序号, 为默认值 则不存在 意味着是新发布的 
		//---》规则(读一遍ini, 找到序号最大值, 加1 并写到tuopfile.ini文件中)
		int nSort = GetIniFileInt("sort", strVSD, -1, "tuopfile.ini");
		if(nSort != -1)
		{
			list.nSort = nSort;
		}
		else
		{
			//获取序号最大值, 加1
			list.nSort = GetMaxSortId() + 1;

			//写序号值到ini
		#ifdef	 Tuopu
			WriteIniFileInt("sort", strVSD, list.nSort, "tuopfile.ini");
		#else
			WriteIniFileInt("sort", strVSD, list.nSort, "maintainfile.ini");
		#endif
		}

		RecordList.push_back(list);

		m_pVItem++;
	}	
	
	
	//绑定编辑事件
	connect(&m_userMapper, SIGNAL(mapped(const std::string)), this, SLOT(EditUserName(const std::string)));

	//显示列表
	int i = 1;
	std::string strOpen;

	for(m_pRecordList=RecordList.begin(); m_pRecordList != RecordList.end(); m_pRecordList ++)
	{
		m_pTopologyListTable->InitRow(i);
		pSortTable->InitRow(i);
		i++;
	}

	i = 1;
	for(m_pRecordList=RecordList.begin(); m_pRecordList != RecordList.end(); m_pRecordList ++)
	{
		//列表数据界面初始化
		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 0)->setContentAlignment(AlignCenter);
		m_pRecordList->pCheckBox = new WCheckBox("", (WContainerWidget*)m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 0));		

		strOpen = "<a href=./showtuopu.exe?pageid=";
		strOpen += ReplaceStdString(m_pRecordList->strBackName, ".htm", "");
	#ifdef	 Tuopu
		strOpen += "&version=0";
	#else
		strOpen += "&version=0&usrleader=0&maintain=1";
	#endif
		strOpen += " target=_blank>";
		strOpen += m_pRecordList->strUserName;
		strOpen += "</a>";

		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2)->setContentAlignment(AlignCenter);
		m_pRecordList->pstrUserName = new WText(strOpen, (WContainerWidget*)m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));
		

		m_pRecordList->pLineEdit = new WLineEdit(m_pRecordList->strUserName,m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));
		m_pRecordList->pLineEdit->hide();


		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4)->setContentAlignment(AlignCenter);		
		m_pRecordList->pTuop = new WImage("../Images/resource.gif",m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4));
		m_pRecordList->pTuop->setToolTip(strTuopTip);
		m_pRecordList->pTuop->setStyleClass("hand");

		//绑定visio事件
		std::string strJavascript;

	#ifdef	 Tuopu
		strJavascript = "window.open('../tuoplist/" + m_pRecordList->strTuop + "','newwindow')";	
	#else
		strJavascript = "window.open('../maintainlist/" + m_pRecordList->strTuop + "','newwindow')";	
	#endif

		connect(m_pRecordList->pTuop, SIGNAL(clicked()),strJavascript.c_str() ,WObject::JAVASCRIPT );

		m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 6)->setContentAlignment(AlignCenter);
		m_pRecordList->pEdit = new WImage("/Images/edit.gif",m_pTopologyListTable->GeDataTable()->elementAt(m_pRecordList->nSort, 6));		
		m_pRecordList->pEdit->setToolTip(strEditTip);
		m_pRecordList->pEdit->setStyleClass("hand");
		
		strIndex=m_pRecordList->strUserName.c_str();

		m_userMapper.setMapping(m_pRecordList->pEdit, strIndex); 
		
		connect(m_pRecordList->pEdit, SIGNAL(clicked()), &m_userMapper, SLOT(map()));
		connect(m_pRecordList->pLineEdit, SIGNAL(keyWentDown(int)), this, SLOT(EditReturn(int)));
		i++;

		//排序数据界面初始化
		pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2)->setContentAlignment(AlignCenter);
		WText * pTmpText = new WText(m_pRecordList->strUserName, pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 2));

		char chItem[32]  = {0};	
		sprintf(chItem, "%d", m_pRecordList->nSort);
		string strSort = chItem;

		pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4)->setContentAlignment(AlignCenter);
		WLineEdit * pTmpEdit = new WLineEdit(strSort, pSortTable->GeDataTable()->elementAt(m_pRecordList->nSort, 4));

		//放到sv_table里去
		SVTableCell ce;
		ce.setType(adText);
		ce.setValue(pTmpText);
		m_svSortList.WriteCell(m_pRecordList->strTuop, 0, ce);

		ce.setType(adLineEdit);
		ce.setValue(pTmpEdit);
		m_svSortList.WriteCell(m_pRecordList->strTuop, 1, ce);
	}
	
	m_pList.clear();
	m_pVList.clear();
	
	//列表为空
	if(RecordList.size() <= 0)
	{
		m_pTopologyListTable->ShowNullTip();
	}
	else
	{
		m_pTopologyListTable->HideNullTip();
	}

	pSortTable->hide();


	//隐藏按钮
	pHideBtn = new WPushButton("hide button",this);
	if(pHideBtn)
	{
		pHideBtn->setToolTip("Hide Button");
		connect(pHideBtn,SIGNAL(clicked()),this,SLOT(DelUser()));
		pHideBtn->hide();
	}

	pTranslateBtn = new WPushButton("Translate",this);
	pExChangeBtn = new WPushButton("Refresh",this);

	//翻译
	int bTrans = GetIniFileInt("translate", "translate", 0, "general.ini");
	if(bTrans == 1)
	{
		this->pTranslateBtn->show();
		connect(this->pTranslateBtn, SIGNAL(clicked()), this, SLOT(Translate()));	

		this->pExChangeBtn->show();
		connect(this->pExChangeBtn, SIGNAL(clicked()), this, SLOT(ExChange()));	
	}
	else
	{
		this->pTranslateBtn->hide();
		this->pExChangeBtn->hide();
	}
}
Esempio n. 14
0
bool  PPD_Base::ReadFromFile()
{
    basePDReadMaj = ReadInt();
    basePDReadMin = ReadInt();

    ReadFuncObjRef(basePD.plotPenSetObjRef);
    basePD.plotBackgroundPen = ReadInt();
    basePD.plotUwidth        = ReadInt();
    basePD.plotVheight       = ReadInt();

    if (basePDReadMaj > 0)
    {
        basePD.rightMargin  = ReadInt();
        basePD.leftMargin   = ReadInt();
        basePD.topMargin    = ReadInt();
        basePD.bottomMargin = ReadInt();
    }

    //  moved to 2D only in ver 4
    if ((basePDReadMaj > 1) && (basePDReadMaj < 4))
        bool dummyshowReportArea = ReadBool();

    if (basePDReadMaj > 2)
    {
        ReadFileName(basePD.tgaOutput.tgaRootFile);

        if (basePDReadMaj > 9)
            basePD.tgaOutput.dumpFormat = PC_DumpTGA::DumpFormat(ReadInt());

        basePD.tgaOutput.dumpMethod    = PC_DumpTGA::TGADumpMethod(ReadInt());

        // we rarely ever really want auto on read ...
        if (basePD.tgaOutput.dumpMethod == PC_DumpTGA::dtga_FullAuto)
            basePD.tgaOutput.dumpMethod = PC_DumpTGA::dtga_SemiAuto;

        basePD.tgaOutput.nextIncrement = ReadInt();
        if (basePDReadMaj > 6)
            basePD.tgaOutput.dumpFrameCount = ReadInt();
    }

    if (basePDReadMaj > 4)
    {
        ReadFileName(basePD.psOutput.outputFile);
        basePD.psOutput.outputFormat     = PC_PSOutData::OutputFormat(ReadInt());
        basePD.psOutput.outputIsPortrait = ReadBool();

        basePD.psOutput.pageWidth    = ReadDouble();
        basePD.psOutput.pageHeight   = ReadDouble();
        basePD.psOutput.rightMargin  = ReadDouble();
        basePD.psOutput.leftMargin   = ReadDouble();
        basePD.psOutput.topMargin    = ReadDouble();
        basePD.psOutput.bottomMargin = ReadDouble();

        if (basePDReadMaj > 5)
        {
            basePD.psOutput.lineWidthMultiplier  = ReadDouble();
            basePD.psOutput.gammaCorrection      = ReadDouble();
            basePD.psOutput.zBufferMultiplier    = ReadDouble();
            basePD.psOutput.textLengthMultiplier = ReadDouble();
        }
        if (basePDReadMaj > 8)
            basePD.psOutput.arialIsHelvetica  = ReadBool();
        if (basePDReadMaj > 10)
            basePD.psOutput.nextPSIncrement  = ReadInt();

    }

    if (basePDReadMaj > 7)
    {
        basePD.plotDefIsActive = ReadBool();
        basePD.axesHaveBeenSet = ReadBool();
    }

    return true;
}