Patch level : 10.0 0044
Files correlati : Postman Ricompilazione Demo : [ ] Commento : Corretta scrittura file ini (tolti i '\' di troppo) git-svn-id: svn://10.65.10.50/trunk@16566 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
7f0c7a2cbf
commit
2d75aa8409
@ -166,7 +166,7 @@ void TBaseServerApp::WriteLog(const wxChar* str) const
|
||||
*m_log << str << endl;
|
||||
}
|
||||
|
||||
wxString TBaseServerApp::GetTempFilename()
|
||||
wxString TBaseServerApp::GetTempFilename(const wxChar * ext)
|
||||
{
|
||||
wxString strTmp;
|
||||
if (m_strTempDir.IsEmpty())
|
||||
@ -177,9 +177,9 @@ wxString TBaseServerApp::GetTempFilename()
|
||||
(wxString&)m_strTempDir << ::wxPathOnly(strTmp) << "/";
|
||||
}
|
||||
strTmp = m_strTempDir;
|
||||
strTmp += wxString::Format("%s_%d.htm", GetAppName(), m_nTmpCounter);
|
||||
strTmp += wxString::Format("%s_%d.%s", GetAppName(), m_nTmpCounter, ext);
|
||||
m_nTmpCounter++;
|
||||
if (m_nTmpCounter >= 4)
|
||||
if (m_nTmpCounter >= 32)
|
||||
m_nTmpCounter = 0;
|
||||
|
||||
return strTmp;
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
bool GetConfigBool(const wxChar* key, bool def = false, const wxChar* app = NULL) const; // Uses GetConfigString
|
||||
virtual wxString GetLogFileName() const;
|
||||
|
||||
wxString GetTempFilename();
|
||||
wxString GetTempFilename(const wxChar * ext = "htm");
|
||||
TXmlItem& CreatePageBody(TXmlItem& html, wxString header = "") const;
|
||||
TXmlItem& AddLinkButton(TXmlItem& body, const wxChar* strCaption, const wxChar* strHref) const;
|
||||
|
||||
|
@ -122,6 +122,7 @@ protected:
|
||||
bool LoadEditors(const wxChar * filename, wxArrayString & editors);
|
||||
void SaveXml2IniParagraph(wxFileConfig & ini, TXmlItem& xmlItem);
|
||||
void SaveTransaction(const TXmlItem& xmlMethod, wxString & filename);
|
||||
void AdjustTransaction(wxString & filename);
|
||||
const wxString EditorCommand();
|
||||
void ExecuteTransaction(wxString & filename);
|
||||
void LoadXmlParagraph(TXmlItem & xmlItem, wxString & paragraph, wxString & filename);
|
||||
@ -340,6 +341,8 @@ void TPostmanServer::SaveTransaction(const TXmlItem& xmlMethod, wxString & filen
|
||||
wxString paragraph;
|
||||
int items = xmlMethod.GetChildren();
|
||||
|
||||
if (wxFileName::FileExists(filename))
|
||||
wxRemoveFile(filename);
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
TXmlItem * child = xmlMethod.GetChild(i);
|
||||
@ -369,6 +372,33 @@ void TPostmanServer::SaveTransaction(const TXmlItem& xmlMethod, wxString & filen
|
||||
SaveXml2IniParagraph(ini, *child);
|
||||
}
|
||||
}
|
||||
|
||||
void TPostmanServer::AdjustTransaction(wxString & filename)
|
||||
{
|
||||
wxTextFile file(filename);
|
||||
bool changed = false;
|
||||
|
||||
if (file.Open())
|
||||
{
|
||||
for (wxString & row = file.GetFirstLine(); !file.Eof(); row = file.GetNextLine())
|
||||
{
|
||||
const int pos = row.Find("\\,");
|
||||
if (pos > 0)
|
||||
{
|
||||
row.Remove(pos, 1);
|
||||
changed = true;
|
||||
size_t rowno = file.GetCurrentLine();
|
||||
file.InsertLine(row, rowno);
|
||||
file.RemoveLine(rowno + 1);
|
||||
}
|
||||
}
|
||||
if (changed)
|
||||
file.Write();
|
||||
}
|
||||
else
|
||||
WriteLog("Can't create Transaction file");
|
||||
}
|
||||
|
||||
const wxString TPostmanServer::EditorCommand()
|
||||
{
|
||||
const bool firmchanged = m_Firm != m_LastFirm;
|
||||
@ -546,15 +576,14 @@ void TPostmanServer::SoapProcessMethod(const TXmlItem& xmlMethod, TXmlItem& xmlA
|
||||
if (strMethod == "m:CampoTransaction")
|
||||
{
|
||||
m_Logicnum = 0;
|
||||
wxFileName filename(GetTempFilename());
|
||||
wxFileName filename(GetTempFilename("ini"));
|
||||
|
||||
filename.SetExt("ini");
|
||||
wxString name(filename.GetFullPath());
|
||||
SaveTransaction(xmlMethod, name);
|
||||
AdjustTransaction(name);
|
||||
ExecuteTransaction(name);
|
||||
LoadTransaction(name, xmlAnswer);
|
||||
Log(xmlAnswer, name);
|
||||
wxRemoveFile(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user