From 7f6a81baf9f4f4560cdde66520c2f41c9af03490 Mon Sep 17 00:00:00 2001 From: xj qian <qianxj15@sina.com> Date: 星期三, 23 十月 2024 18:07:13 +0800 Subject: [PATCH] update --- jrj/xframe/devloper/sqlwatch.cpp | 148 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 110 insertions(+), 38 deletions(-) diff --git a/jrj/xframe/devloper/sqlwatch.cpp b/jrj/xframe/devloper/sqlwatch.cpp index b7b61e1..bf1ad65 100644 --- a/jrj/xframe/devloper/sqlwatch.cpp +++ b/jrj/xframe/devloper/sqlwatch.cpp @@ -6,6 +6,7 @@ #include <xcontrol/xlayersheet.hpp> #include <xcontrol/xsedit.hpp> #include <xcontrol/xdwgrid.hpp> +#include <win32/xfile.hpp> using xml = KXMLDOMDocument; class __declspec(dllexport) SqlWatchWin : public xwin { @@ -238,10 +239,13 @@ { KXMLDOMNode node = items.item(i); xstring src = node.selectSingleNode(L"@src").text(); - if (src.find(L"mh.com") < 0) + xstring hDomainGuid = node.selectSingleNode(L"../@guid").text(); + xstring hP2Guid = node.selectSingleNode(L"@guid").text(); + //if (src.find(L"mh.com") < 0) + //if (src.find(L"hxsoft.com") >= 0) { src = src.replace(L"\\", L"/"); - processhxd(base + L"/developer", src); + processhxd(base + L"/developer", src,hDomainGuid,hP2Guid); } } } @@ -252,13 +256,36 @@ return 1; } - int DownLoadFile2(xstring src, xstring dest) + int DownLoadObject(xstring ext,xstring dest) { - int ret = xaserver::DownLoadFile(GetServerUrl(), src, L"", dest); + BYTE* pData = NULL; + int nLength = 0; + int ret = xaserver::ProcessCmd(GetServerUrl(), L"uri.hxsoft.com/xaserver/developer getobject", ext.c_str(), pData, nLength); + if (ret > 0) + { + HANDLE fp1; + DWORD nWrite; +#define GENERIC_READ (0x80000000L) +#define GENERIC_WRITE (0x40000000L) +#define FILE_SHARE_READ 0x00000001 +#define FILE_SHARE_WRITE 0x00000002 +#define CREATE_ALWAYS 2 +#define FILE_ATTRIBUTE_NORMAL 0x00000080 + fp1 = CreateFileW(dest.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + ::WriteFile(fp1, pData, nLength, &nWrite, NULL); + ::CloseHandle(fp1); + if (pData)delete pData; + } + return ret; + } + + int DownLoadFile2(xstring src, xstring dest,xstring ext=L"") + { + int ret = xaserver::DownLoadFile(GetServerUrl(), src, ext, dest); if (ret < 0) { reconnect(); - ret = xaserver::DownLoadFile(GetServerUrl(), src, L"", dest); + ret = xaserver::DownLoadFile(GetServerUrl(), src, ext, dest); } if (ret < 0)reconnect(); return ret; @@ -287,7 +314,7 @@ return 1; } - KXMLDOMNodeList items = x.selectNodes(L"//file[count(@deleted)=0]"); + KXMLDOMNodeList items = x.selectNodes(L"//file[count(ancestor-or-self::*/@deleted)=0 ]"); xstring caption = x.documentElement().getAttribute(L"caption");; xstring srcpath = GetFolder(src); if (caption == L"") @@ -311,6 +338,7 @@ if (node.selectSingleNode(L"@src")) srcItem = node.selectSingleNode(L"@src").text(); xstring typ = L""; if (node.selectSingleNode(L"@type")) typ = node.selectSingleNode(L"@type").text(); + if (typ == L"tpp")typ = L"code"; xstring values = L""; if (srcItem != L"" && typ != L"") { @@ -424,7 +452,7 @@ return 1; } - int processprj_xml(xstring base, xstring path, xstring src, bool processItem) + int processprj_xml(xstring base, xstring path, xstring src, bool processItem, xstring hDomainGuid, xstring hP2Guid, xstring hProjectGuid) { //xcontrol xc = GetControl(L"frame:output"); //xc.SetText(L"\r\n process: "+path+L"/"+src); @@ -447,7 +475,7 @@ return 1; } - KXMLDOMNodeList items = x.selectNodes(L"//file[count(@deleted)=0]"); + KXMLDOMNodeList items = x.selectNodes(L"//file[count(ancestor-or-self::*/@deleted)=0]"); xstring caption = x.documentElement().getAttribute(L"caption");; xstring srcpath = GetFolder(src); if (caption == L"") @@ -461,6 +489,11 @@ surePath(dpath, L""); int len = items.length(); + xaserverarg arg; + arg.AddArg(L"root.guid", hP2Guid); + arg.AddArg(L"domain.guid", hDomainGuid); + arg.AddArg(L"project.guid", hProjectGuid); + for (int i = 0; i < len; i++) { KXMLDOMNode node = items.item(i); @@ -468,17 +501,24 @@ xstring srcItem = L""; xstring id = L""; + xstring uriItem = L""; if (node.selectSingleNode(L"@guid")) id = node.selectSingleNode(L"@guid").text(); if (node.selectSingleNode(L"@src")) srcItem = node.selectSingleNode(L"@src").text(); + if (node.selectSingleNode(L"@uri")) uriItem = node.selectSingleNode(L"@uri").text(); xstring typ = L""; if (node.selectSingleNode(L"@type")) typ = node.selectSingleNode(L"@type").text(); + if (typ == L"tpp")typ = L"code"; xstring values = L""; if (srcItem != L"" && typ != L"") { - ret = DownLoadFile2(L"dev:" + typ + L"[" + srcItem + L"]", dpath + L"/" + srcItem); + arg.AddArg(L"guid", id); + ret = DownLoadObject(arg.GetString(), dpath + L"/" + srcItem); + if(ret < 0) + ret = DownLoadFile2(L"dev:" + typ + L"[" + uriItem + L"]", dpath + L"/" + srcItem); + //ret = DownLoadFile2(L"dev:" + typ + L"[" + srcItem + L"]", dpath + L"/" + srcItem); if (ret < 0) { - trace(L"\r\nerror load dev:" + typ + L"[" + srcItem + L"]" + L" " + dpath + L"/" + srcItem); + trace(L"\r\nerror load dev:" + typ + L"[" + uriItem + L"]" + L" " + dpath + L"/" + srcItem); continue; //return 1; } @@ -491,28 +531,65 @@ { CreateDirectory(base + L"/working/" + typ + L"s", nullptr); //DownLoadFile2(L"dev:"+typ+L"["+srcItem+L"]",base+L"/working"+L"/"+typ+L"s/"+id+L".xrl"); - DownLoadFile2(L"dev:" + typ + id, base + L"/working" + L"/" + typ + L"s/" + id + L".xrl"); + ret = DownLoadFile2(L"dev:" + typ + id, base + L"/working" + L"/" + typ + L"s/" + id + L".xrl"); + if (ret < 0) + { + trace(L"\r\nerror load dev:" + typ + L"[" + uriItem + L"]" + L" " + L"/working" + L"/" + typ + L"s/" + id + L".xrl"); + continue; + //return 1; + } + } else if (typ == L"serialize") { CreateDirectory(base + L"/working/" + typ, nullptr); //DownLoadFile2(L"dev:"+typ+L"["+srcItem+L"]",base+L"/working"+L"/"+typ+L"/"+id+L".xml"); - DownLoadFile2(L"dev:" + typ + id, base + L"/working" + L"/" + typ + L"/" + id + L".xml"); + ret = DownLoadFile2(L"dev:" + typ + id, base + L"/working" + L"/" + typ + L"/" + id + L".xml"); + if (ret < 0) + { + trace(L"\r\nerror load dev:" + typ + L"[" + uriItem + L"]" + L" " + L"/working" + L"/" + typ + L"/" + id + L".xml"); + continue; + //return 1; + } } else if (typ == L"workflow" || typ == L"worknode" || typ == L"xaction" || typ == L"template" || typ == L"xfile" || typ == L"xquery" || typ == L"entity" || typ == L"xpage") { CreateDirectory(base + L"/working/" + typ + L"s", nullptr); - //DownLoadFile2(L"dev:"+typ+L"["+srcItem+L"]",base+L"/working"+L"/"+typ+L"s/"+id+L".xml"); - DownLoadFile2(L"dev:" + typ + id, base + L"/working" + L"/" + typ + L"s/" + id + L".xml"); + ret = DownLoadFile2(L"dev:"+typ+L"["+uriItem+L"]",base+L"/working"+L"/"+typ+L"s/"+id+L".xml"); + //DownLoadFile2(L"dev:" + typ + id, base + L"/working" + L"/" + typ + L"s/" + id + L".xml"); + if (ret < 0) + { + trace(L"\r\nerror load dev:" + typ + L"[" + uriItem + L"]" + L" " + base + L"/working" + L"/" + typ + L"s/" + id + L".xml"); + continue; + //return 1; + } + } + else if (typ == L"code") + { + CreateDirectory(base + L"/working/" + typ, nullptr); + ret = DownLoadFile2(L"dev:" + typ + L"[" + uriItem + L"]", base + L"/working" + L"/" + typ + L"/" + id + L".xss"); + //DownLoadFile2(L"dev:" + typ + id, base + L"/working" + L"/" + typ + L"/" + id); + if (ret < 0) + { + trace(L"\r\nerror load dev:" + typ + L"[" + uriItem + L"]" + L" " + base + L"/working" + L"/" + typ + L"s/" + id+L".xss"); + continue; + //return 1; + } } else { CreateDirectory(base + L"/working/" + typ, nullptr); - //DownLoadFile2(L"dev:"+typ+L"["+srcItem+L"]",base+L"/working"+L"/"+typ+L"/"+id); - DownLoadFile2(L"dev:" + typ + id, base + L"/working" + L"/" + typ + L"/" + id); + ret = DownLoadFile2(L"dev:"+typ+L"["+uriItem+L"]",base+L"/working"+L"/"+typ+L"/"+id); + //DownLoadFile2(L"dev:" + typ + id, base + L"/working" + L"/" + typ + L"/" + id); + if (ret < 0) + { + trace(L"\r\nerror load dev:" + typ + L"[" + uriItem + L"]" + L" " + base + L"/working" + L"/" + typ + L"s/" + id); + continue; + //return 1; + } } - appendto(typ, L"T(\"" + srcItem + L"\",\"" + id + L"\",\"" + spath + L"/" + srcItem + L"\")[ln]"); + appendto(typ, L"T(\"" + uriItem + L"\",\"" + id + L"\",\"" + spath + L"/" + srcItem + L"\")[ln]"); } if (typ == L"template") @@ -528,12 +605,12 @@ xstring content = tnode.xml(); xstring sheetid = L""; xstring sheetcaption = L""; - if (node.selectSingleNode(L"@guid")) sheetid = tnode.selectSingleNode(L"@guid").text(); - if (node.selectSingleNode(L"@caption")) sheetcaption = tnode.selectSingleNode(L"@caption").text(); + if (tnode.selectSingleNode(L"@guid")) sheetid = tnode.selectSingleNode(L"@guid").text(); + if (tnode.selectSingleNode(L"@caption")) sheetcaption = tnode.selectSingleNode(L"@caption").text(); xutil::SaveToFile(base + L"/working/sheets/" + sheetid + L".xml", content, L"", L"", (LPTSTR)L""); - appendto(L"sheet", L"T(\"" + srcItem + L"/" + sheetid + L"\",\"" + sheetid + L"\")[ln]"); - appendto(L"sheet", L"T(\"" + srcItem + L"/" + sheetcaption + L"\",\"" + sheetid + L"\")[ln]"); + appendto(L"sheet", L"T(\"" + uriItem + L"/" + sheetid + L"\",\"" + sheetid + L"\")[ln]"); + appendto(L"sheet", L"T(\"" + uriItem + L"/" + sheetcaption + L"\",\"" + sheetid + L"\")[ln]"); } } } @@ -541,18 +618,18 @@ { xstring srccode = srcItem.replace(L".xpage", L".xss"); srccode = srccode.replace(L".vx", L".xss"); - ret = DownLoadFile2(L"dev:code[" + srcItem + L"]", dpath + L"/" + srccode); + ret = DownLoadFile2(L"dev:code[" + uriItem + L"]", dpath + L"/" + srccode); if (ret < 0) { - trace(L"\r\nerror load dev:code[" + srcItem + L"]" + L" " + dpath + L"/" + srccode); + trace(L"\r\nerror load dev:code[" + uriItem + L"]" + L" " + dpath + L"/" + srccode); continue; //return 1; } if (id != L"") { - DownLoadFile2(L"dev:code[" + srcItem + L"]", base + L"/working" + L"/code/" + id + L".xss"); + DownLoadFile2(L"dev:code[" + uriItem + L"]", base + L"/working" + L"/code/" + id + L".xss"); //DownLoadFile2(L"dev:code"+id,base+L"/working"+L"/code/"+id+L".xss"); - appendto(L"code", L"T(\"" + srcItem + L"\",\"" + id + L"\",\"" + spath + L"\"" + srcItem + L"\")[ln]"); + appendto(L"code", L"T(\"" + uriItem + L"\",\"" + id + L"\",\"" + spath + L"\"" + srcItem + L"\")[ln]"); } } } @@ -561,7 +638,7 @@ return 1; } - int processhxd(xstring base, xstring sfile) + int processhxd(xstring base, xstring sfile,xstring hDomainGuid,xstring hP2Guid) { surePath(base, sfile); trace(L"\r\n" + base + L"/" + sfile); @@ -575,18 +652,20 @@ xml xhd ; xhd.load(base + L"/" + sfile); + KXMLDOMNodeList items = xhd.selectNodes(L"//project[count(@deleted)=0]"); int len = items.length(); for (int i = 0; i < len; i++) { KXMLDOMNode node = items.item(i); + xstring hProjectGuid = node.selectSingleNode(L"@guid").text(); xstring src = L""; if (node.selectSingleNode(L"@src")) src = node.selectSingleNode(L"@src").text(); if (src != L"") { xstring path = GetFolder(sfile); src = src.replace(L"\\", L"/"); - processprj_xml(base, path, src, true); + processprj_xml(base, path, src, true,hDomainGuid,hP2Guid,hProjectGuid); } } return 1; @@ -596,14 +675,14 @@ { xstring values = L""; if (xutil::HasCacheData(L"object-types"))values = xutil::GetUrlData(L"object-types"); - values = values.replace(L",,L", L",L"); + values = values.replace(L",,", L","); if (values != L"") { - int pos = values.find(L",L", 0); + int pos = values.find(L",", 0); xstring typ = L""; while (pos >= 0) { - int pos1 = values.find(L",L", pos + 1); + int pos1 = values.find(L",", pos + 1); if (pos1 < 0) break; typ = values.mid(pos + 1, pos1 - pos - 1); xutil::CacheUrlData(typ, L""); @@ -615,14 +694,7 @@ } int Initenv_xml() { - if (!toXml) - { - toXml = xml(); - } - else - { - if (toEle)toEle.Release(); - } + toXml.Reset(); toXml.loadXML(L"<root/>"); toEle = toXml.documentElement(); return 1; -- Gitblit v1.9.3