Beispiel #1
0
void CNewfileDlg::OnBnClickedButtonDeltet()
{
	// TODO: Add your control notification handler code here
	HTREEITEM hCurItem = m_tree.GetSelectedItem();
	if (hCurItem){
		ndxml *xml = (ndxml*)(m_tree.GetItemData(hCurItem));
		if (!xml) {
			return;			
		}
		ndxml_root *xmlfiles = ndxml_getnode(&m_xmlRoot, "script_file_manager");
		if (!xmlfiles){
			return;
		}
		int num = ndxml_num(xmlfiles);
		for (int i = 0; i < num; i++) {
			ndxml *node = ndxml_getnodei(xmlfiles, i);
			if (node == xml) {
				if (IDYES != AfxMessageBox("是否要删除?", MB_YESNO))	{
					return;
				}
				nd_rmfile(ndxml_getval(node));
				ndxml_delxml(node, xmlfiles);

				SaveXmlFile();
				ShowFileList();
				return;
			}
		}

	}
}
Beispiel #2
0
void CNewfileDlg::OnBnClickedButtonNew()
{
	CString filter;
	filter = " default Files (*.xml)| *.xml||";
	CFileDialog myfile(false, _T("*.xml"),NULL, OFN_OVERWRITEPROMPT, (LPCTSTR)filter, NULL);
	if (myfile.DoModal() != IDOK)	{
		return ;
	}

	CString strFile = myfile.GetPathName();
	if (strFile.IsEmpty())	{
		return;
	}
	ndxml_root *xml = ndxml_getnode(&m_xmlRoot, "script_file_manager");
	if (!xml){
		AfxMessageBox(_T("文件损坏"));
		return;
	}
	if (-1 == nd_cpfile(m_fileTemplate, (LPCTSTR)strFile)) {
		AfxMessageBox(_T("不能保存文件"));
		return;
	}
	ndxml *newNode = ndxml_addnode(xml, "file", (LPCTSTR)strFile);
	if (newNode){
		CString cName = myfile.GetFileTitle();
		ndxml_addattrib(newNode, "name", (LPCTSTR)cName);
	}
	SaveXmlFile();
	ShowFileList();
}
Beispiel #3
0
BOOL CNewfileDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	ShowFileList();

	return TRUE;
}
Beispiel #4
0
void FileList::DisplayObject()
{
	Height=Y2-Y1-4+!Opt.ShowColumnTitles+(Opt.ShowPanelStatus ? 0:2);
	_OT(SysLog(L"[%p] FileList::DisplayObject()",this));

	if (UpdateRequired)
	{
		UpdateRequired=FALSE;
		Update(UpdateRequiredMode);
	}

	ProcessPluginCommand();
	ShowFileList(FALSE);
}
Beispiel #5
0
void CFileListView::LookItem( int nIndex )
{
	if(nIndex == -1)
		return;

	char szText[64];
	if(GetItemText(nIndex, 1, szText, 64))
	{
		if(strcmp(szText,DIR_STR) == 0)
		{
			if(GetItemText(nIndex, 0, szText, 64))
				ShowFileList(szText);
		}
	}
}
Beispiel #6
0
bool CFileListView::OnDropFiles( HDROP hDrop )
{
	char szFileName[MAX_PATH];
	char szPath[MAX_PATH] = {0};
	UInt32 nTotalCount;

	if(m_pArchive == NULL)
	{
		DragQueryFile(hDrop, 0, szFileName, MAX_PATH);
		OpenArchive(szFileName);
	}
	else
	{
		if(m_FileStack.size() > 1)
			GetCurrentPath(szPath,MAX_PATH);

		ProgressDlg progDlg;
		progDlg.SetArchiveHandle(m_pArchive);
		progDlg.SetCompression(m_nCompression);
		progDlg.AddToDir(szPath);

		nTotalCount = DragQueryFile(hDrop, -1, NULL, 0);
		for (UInt32 i = 0; i < nTotalCount; ++i)
		{
			DragQueryFile(hDrop, i, szFileName, MAX_PATH);
			progDlg.AddFile(szFileName);
		}

		progDlg.Exec(this);

		RefreshFileList();
		ShowFileList(szPath);
	}

	DragFinish(hDrop);

	return true;
}
Beispiel #7
0
bool CFileListView::OpenArchive( const char* pFileName )
{
	CloseArchive();

	m_pArchive = archive_open(pFileName,0);
	if(m_pArchive == NULL)
	{
		ErrotTip();
		return false;
	}

	if(m_pParent != NULL)
	{
		char szTitle[MAX_PATH];
		sprintf_s(szTitle, MAX_PATH, "JArchiveEditor - %s",pFileName);
		m_pParent->SetWindowText(szTitle);
		strcpy_s(m_szArchiveName, MAX_PATH, pFileName);
	}

	RefreshFileList();
	ShowFileList(NULL);
	return true;
}