// ----------------------------------------------------------------------------
bool clKeyboardManager::ReadFileContent(const wxFileName& fn, wxString& data, const wxMBConv& conv)    //(2019/04/3)
// ----------------------------------------------------------------------------

{
    wxString filename = fn.GetFullPath();
    wxFFile file(filename, wxT("rb"));
    if(file.IsOpened() == false) {
        // Nothing to be done
        return false;
    }
    return file.ReadAll(&data, conv);
}
Exemplo n.º 2
0
size_t FileUtils::GetFileSize(const wxFileName& filename)
{
    struct stat b;
    wxString file_name = filename.GetFullPath();
    const char* cfile = file_name.mb_str(wxConvUTF8).data();
    if(::stat(cfile, &b) == 0) {
        return b.st_size;
    } else {
        clERROR() << "Failed to open file:" << file_name << "." << strerror(errno);
        return 0;
    }
}
Exemplo n.º 3
0
void FileUtils::OpenFileExplorerAndSelect(const wxFileName& filename)
{
#ifdef __WXMSW__
    wxString strPath = filename.GetFullPath();
    if(strPath.Contains(" ")) { strPath.Prepend("\"").Append("\""); }
    wxString cmd;
    cmd << "explorer /select," << strPath;
    ::wxExecute(cmd);
#else
    OpenFileExplorer(filename.GetPath());
#endif
}
Exemplo n.º 4
0
t4p::ExplorerModifyEventClass::ExplorerModifyEventClass(int eventId, const wxFileName &oldFile,
        const wxString &newName, bool success)
    : wxEvent(eventId, t4p::EVENT_EXPLORER_MODIFY)
    , OldFile(oldFile.GetFullPath())
    , NewName(newName.c_str())
    , DirsDeleted()
    , FilesDeleted()
    , DirsNotDeleted()
    , FilesNotDeleted()
    , Action(t4p::ExplorerModifyActionClass::RENAME_FILE)
    , Success(success) {
}
Exemplo n.º 5
0
wxString wxMakeFileURI(const wxFileName &fn)
{
    wxString path = fn.GetFullPath();

    // in case we are using win32 paths with backslashes...
    // (this must be done also under Unix since even there we could
    //  be forced to handle win32 paths)
    path.Replace(wxT("\\"), wxT("/"));

    // now use wxURI as filter
    return wxURI(wxT("file:") + path).BuildURI();
}
bool FileUtils::WriteFileContent(const wxFileName& fn, const wxString& content, const wxMBConv& conv)
{
    wxFFile file(fn.GetFullPath(), wxT("w+b"));
    if(!file.IsOpened()) {
        return false;
    }

    if(!file.Write(content, conv)) {
        return false;
    }
    return true;
}
Exemplo n.º 7
0
bool wxExCompareFile(const wxFileName& file1, const wxFileName& file2)
{
    if (wxConfigBase::Get()->Read(_("Comparator")).empty())
    {
        return false;
    }

    const wxString arguments =
        (file1.GetModificationTime() < file2.GetModificationTime()) ?
        "\"" + file1.GetFullPath() + "\" \"" + file2.GetFullPath() + "\"":
        "\"" + file2.GetFullPath() + "\" \"" + file1.GetFullPath() + "\"";

    if (wxExecute(wxConfigBase::Get()->Read(_("Comparator")) + " " + arguments) == 0)
    {
        return false;
    }

    wxLogStatus(_("Compared") + ": " + arguments);

    return true;
}
Exemplo n.º 8
0
bool HexEditorCtrl::SaveTAGS( wxFileName flnm ){
	if( MainTagArray.Count() ==  0){
		if( flnm.FileExists() )
			wxRemoveFile( flnm.GetFullPath() << wxT(".tags") );
		return false;
		}
	else{
		wxXmlDocument doc;

		wxXmlNode *node_Root = new wxXmlNode( NULL, wxXML_ELEMENT_NODE, wxT("wxHexEditor_XML_TAG"), wxEmptyString, NULL , NULL);

		wxXmlProperty *prop_filename = new wxXmlProperty( wxT("path"), flnm.GetFullPath(), NULL);
		wxXmlNode *node_File = new wxXmlNode( node_Root, wxXML_ELEMENT_NODE, wxT("filename"), flnm.GetFullPath(), prop_filename , NULL);

		for(unsigned i = 0 ; i < MainTagArray.Count() ; i++ ){
			TagElement *TAG = MainTagArray.Item(i);

			wxXmlProperty *ID = new wxXmlProperty( wxT("id"), wxString::Format(wxT("%d"),i), NULL );
			wxXmlNode *node_Tag = new wxXmlNode( node_File, wxXML_ELEMENT_NODE, wxT("TAG"), wxEmptyString, ID , NULL);

			wxXmlNode *element_NoteColour		= new wxXmlNode( node_Tag, wxXML_ELEMENT_NODE, wxT("note_colour"), wxEmptyString, NULL, NULL);
			new wxXmlNode( element_NoteColour, wxXML_TEXT_NODE, wxT("note_colour"), TAG->NoteClrData.GetColour().GetAsString(wxC2S_HTML_SYNTAX), NULL, NULL);

			wxXmlNode *element_FontColour		= new wxXmlNode( node_Tag, wxXML_ELEMENT_NODE, wxT("font_colour"), TAG->FontClrData.GetColour().GetAsString(wxC2S_HTML_SYNTAX), NULL, element_NoteColour);
			new wxXmlNode( element_FontColour, wxXML_TEXT_NODE, wxT("font_colour"), TAG->FontClrData.GetColour().GetAsString(wxC2S_HTML_SYNTAX), NULL, NULL);

			wxXmlNode *element_TagText		= new wxXmlNode( node_Tag, wxXML_ELEMENT_NODE, wxT("tag_text"), TAG->tag, NULL, element_FontColour);
			new wxXmlNode( element_TagText, wxXML_TEXT_NODE, wxT("tag_text"), TAG->tag, NULL, NULL);

			wxXmlNode *element_End 			= new wxXmlNode( node_Tag, wxXML_ELEMENT_NODE, wxT("end_offset"), wxString::Format(wxT("%ld"),TAG->end ) , NULL, element_TagText);
			new wxXmlNode( element_End, wxXML_TEXT_NODE, wxT("end_offset"), wxString::Format(wxT("%ld"),TAG->end ) , NULL, NULL);

			wxXmlNode *element_Start		= new wxXmlNode( node_Tag, wxXML_ELEMENT_NODE, wxT("start_offset"), wxString::Format(wxT("%ld"), TAG->start ), NULL, element_End);
			new wxXmlNode( element_Start, wxXML_TEXT_NODE, wxT("start_offset"), wxString::Format(wxT("%ld"), TAG->start ), NULL, NULL);
			}
		doc.SetFileEncoding( wxT("UTF-8") );
		doc.SetRoot( node_Root );
		return doc.Save(flnm.GetFullPath().Append(wxT(".tags")));
		}
	}
Exemplo n.º 9
0
bool wxcHelper::CreateEmptyFile( const wxFileName& fn )
{
    if ( fn.FileExists() ) {
        if ( ::cbMessageBox(_("A file with this name already exists, would you like to replace it?"), wxT("wxCrafter"), wxYES_NO|wxCENTER|wxICON_QUESTION) != wxID_YES ) {
            return false;
        }
        // Remove the current file
        if ( !::wxRemoveFile( fn.GetFullPath() ) ) {
            return false;
        }
    }

    // Create an empty file
    wxFFile fp(fn.GetFullPath(), wxT("w+b"));
    if( !fp.IsOpened() ) {
        wxString errmsg;
        errmsg << _("Failed to create file '") << fn.GetFullPath() << wxT("'");
        ::wxMessageBox(errmsg, wxT("wxCrafter"), wxICON_ERROR|wxCENTER|wxOK);
        return false;
    }
    return true;
}
Exemplo n.º 10
0
//////////////////////////////////////////////////////////////////////////////
///  public GetFileContents
///  Get the contents of a file from the server.
///
///  @param  file     wxFileName  What file to get.
///  @param  contents wxString &  The return value.
///
///  @return bool     Whether the call succeeded or not.
///
///  @author David Czechowski @date 04-22-2004
//////////////////////////////////////////////////////////////////////////////
bool Networking::GetFileContents(wxFileName file, wxString &contents)
{
	bool success = false;

	if(GetStatus() == NET_GOOD) {
		if( SSHGetFileContents(file.GetFullPath(wxPATH_UNIX), contents) ) {
			m_statusDetails = "";
			success = true;
		}
	}

	return success;
}
Exemplo n.º 11
0
wxString clCxxWorkspace::GetProjectFromFile(const wxFileName& filename) const
{
    wxString filenameFP = filename.GetFullPath();
    clCxxWorkspace::ProjectMap_t::const_iterator iter = m_projects.begin();
    for(; iter != m_projects.end(); ++iter) {
        wxStringSet_t allFiles;
        iter->second->GetFiles(allFiles);
        if(allFiles.count(filenameFP)) {
            return iter->first;
        }
    }
    return "";
}
Exemplo n.º 12
0
void MainFrame::LoadEntryFromFile(const wxFileName &filename) {
  wxProgressDialog progress("Loading", "Now Loading", 4, this,
                            wxPD_CAN_ABORT | wxPD_AUTO_HIDE | wxPD_APP_MODAL);

  auto entry = T::Create(filename, [&progress]() { return progress.Pulse(); });
  if (entry == nullptr) {
    // wxMessageBox("Failed to load file", "Error", wxICON_ERROR);
    return;
  }
  SetEntry(std::shared_ptr<Entry>(entry));

  currentFileCtrl->SetValue(filename.GetFullPath());
}
Exemplo n.º 13
0
    static wxFileName RandomName(const wxFileName& base, int length = 10)
    {
        static int ALFA_CNT = 'z' - 'a';

        wxString s;
        for (int i = 0 ; i < length; ++i)
        {
            char c = 'a' + (rand() % ALFA_CNT);
            s += c;
        }

        return wxFileName(base.GetFullPath(), s);
    }
void CompilerCommandLineParser::AddIncludesFromFile(const wxFileName& includeFile)
{
    wxFFile fp( includeFile.GetFullPath(), "rb" );
    if ( fp.IsOpened() ) {
        wxString content;
        fp.ReadAll( &content );
        content.Replace("\n", " ");
        CompilerCommandLineParser cclp( content );
        m_includes.insert(m_includes.end(), cclp.GetIncludes().begin(), cclp.GetIncludes().end());
        m_includesWithPrefix.insert(m_includesWithPrefix.end(), cclp.GetIncludesWithPrefix().begin(), cclp.GetIncludesWithPrefix().end());
        fp.Close();
    }
}
Exemplo n.º 15
0
void RefactoringEngine::RenameLocalSymbol(const wxString& symname, const wxFileName& fn, int line, int pos)
{
    // Clear previous results
    Clear();

    // Load the file and get a state map + the text from the scanner
    CppWordScanner scanner(fn.GetFullPath());

    // get the current file states
    TextStatesPtr states = scanner.states();
    if( !states ) {
        return;
    }


    // get the local by scanning from the current function's
    TagEntryPtr tag = TagsManagerST::Get()->FunctionFromFileLine(fn, line + 1);
    if( !tag ) {
        return;
    }

    // Get the line number of the function
    int funcLine = tag->GetLine() - 1;

    // Convert the line number to offset
    int from = states->LineToPos     (funcLine);
    int to   = states->FunctionEndPos(from);

    if(to == wxNOT_FOUND)
        return;

    // search for matches in the given range
    CppTokensMap l;
    scanner.Match(symname, l, from, to);

    CppToken::List_t tokens;
    l.findTokens(symname, tokens);
    if (tokens.empty())
        return;

    // Loop over the matches
    // Incase we did manage to resolve the word, it means that it is NOT a local variable (DoResolveWord only wors for globals NOT for locals)
    RefactorSource target;
    std::list<CppToken>::iterator iter = tokens.begin();
    for (; iter != tokens.end(); iter++) {
        wxFileName f( iter->getFilename() );
        if (!DoResolveWord(states, wxFileName(iter->getFilename()), iter->getOffset(), line, symname, &target)) {
            m_candidates.push_back( *iter );
        }
    }
}
Exemplo n.º 16
0
bool clTreeCtrlPanel::ExpandToFile(const wxFileName& filename)
{
    wxArrayString topFolders;
    wxArrayTreeItemIds topFoldersItems;
    GetTopLevelFolders(topFolders, topFoldersItems);

    int where = wxNOT_FOUND;
    wxString fullpath = filename.GetFullPath();
    for(size_t i = 0; i < topFolders.size(); ++i) {
        if(fullpath.StartsWith(topFolders.Item(i))) {
            where = i;
            break;
        }
    }

    // Could not find a folder that matches the filename
    if(where == wxNOT_FOUND) return false;
    wxString topFolder = topFolders.Item(where);
    wxTreeItemId closestItem = topFoldersItems.Item(where);
    fullpath.Remove(0, topFolder.length());
    wxFileName left(fullpath);

    wxArrayString parts = left.GetDirs();
    parts.Add(filename.GetFullName());
    clTreeCtrlData* d = GetItemData(closestItem);
    while(!parts.IsEmpty()) {
        if(!d->GetIndex()) return false; // ??
        wxTreeItemId child = d->GetIndex()->Find(parts.Item(0));
        if(!child.IsOk()) {
            // Probably the this folder was not expanded just yet...
            if(d->IsFolder()) {
                DoExpandItem(closestItem, true);
                // Try again
                child = d->GetIndex()->Find(parts.Item(0));
                if(!child.IsOk()) {
                    return false;
                }
            }
        }
        closestItem = child;
        d = GetItemData(closestItem);
        parts.RemoveAt(0);
    }

    if(parts.IsEmpty()) {
        // we found our file!
        SelectItem(closestItem);
        return true;
    }
    return false;
}
Exemplo n.º 17
0
bool ConfigOptionsDialog::ParseConfigFile(const wxFileName & parseFileName, bool isPlugin)
{
  // Check that the config definition file exists
  if(!parseFileName.FileExists())
  { 
    wxLogError("Unable to find config definition (%s) - file does not exist", parseFileName.GetFullPath().c_str());     
    return false;
  }

  // Parse the file
  ConfigParser parserLoader;
  if(!parserLoader.Parse(string(parseFileName.GetFullPath().c_str())))
  {
    wxLogError("Error in parsing (%s)", parseFileName.GetFullPath().c_str());     
    return false;
  }

  // If this is a plugin, add to the plugin array
  if(isPlugin)
  {
    if(!ExtractConfigPlugins(parserLoader.GetRootToken()))
    {
      return false;
    }
  }
  else
  {
    // Create the main config options from the file
    if(!ExtractConfigHeaders(gridValues, parserLoader.GetRootToken()))
    {
      return false;
    }
  }

  // Log any unused tokens
  parserLoader.LogUnusedTokens();
  return true;
}
Exemplo n.º 18
0
THISCLASS::SimulationParticles(const wxFileName &filename):
		mFrames(), mFrameRead(), mFileName(filename), mFile(0),
		mCurrentFrame(mFrames.end()), mEmptyFrame() {

	// Initialize structures
	mFrameRead.number = 0;
	mFrameRead.particles.clear();
	mCurrentFrame = mFrames.end();

	// Open file
	mFile = new std::ifstream();
	mFile->clear();
	mFile->open(filename.GetFullPath().mb_str(wxConvFile), std::ios::in);
}
Exemplo n.º 19
0
bool ArtDrvSim::ReadImage(const wxFileName &simName)
{
   FILE* ifi;
   if (!simName.IsOk()) return false;

   if ( (ifi = ::fopen(simName.GetFullPath().fn_str(), "rb"))==NULL) {
      // open fails...
      return false;
   }
   size_t fLength = m_camProps.nPixelsX*m_camProps.nPixelsY * 2;
   size_t fRead = ::fread(m_imageData, 1, fLength, ifi);
   ::fclose(ifi);
   return (fLength==fRead);
}
Exemplo n.º 20
0
int wxExGetIconID(const wxFileName& filename)
{
    if (filename.FileExists(filename.GetFullPath()) ||
            filename.DirExists(filename.GetFullPath()))
    {
        if (filename.DirExists(filename.GetFullPath()))
        {
            return wxFileIconsTable::folder;
        }
        else if (!filename.GetExt().empty())
        {
            return wxTheFileIconsTable->GetIconID(filename.GetExt());
        }
        else
        {
            return wxFileIconsTable::file;
        }
    }
    else
    {
        return wxFileIconsTable::computer;
    }
}
IFSTREAM_LINE_READER::IFSTREAM_LINE_READER( const wxFileName& aFileName ) throw( IO_ERROR ) :
        m_fStream( aFileName.GetFullName().ToUTF8() )
{
    if( !m_fStream.is_open() )
    {
        wxString msg = wxString::Format(
            _( "Unable to open filename '%s' for reading" ), aFileName.GetFullPath().GetData() );
        THROW_IO_ERROR( msg );
    }

    setStream( m_fStream );

    source = aFileName.GetFullName();
}
Exemplo n.º 22
0
bool wxTreeMultiXmlMapper::InitWizard(const wxFileName &xmlfile, const wxString &start_tag)
{
    wxCHECK(m_ctrl, false);

    // create a new XML document
    InitXML();
    wxCHECK(m_tiDoc, false);

    // load the contents from disk
    if(m_tiDoc->LoadFile(xmlfile.GetFullPath().c_str()))
        return DoInitWizard(start_tag);

	return false;
}
Exemplo n.º 23
0
void ColoursAndFontsManager::LoadJSON(const wxFileName& path)
{
    if(!path.FileExists()) return;

    JSONRoot root(path);
    JSONElement arr = root.toElement();
    int arrSize = arr.arraySize();
    CL_DEBUG("Loading JSON file: %s (contains %d lexers)", path.GetFullPath(), arrSize);
    for(int i = 0; i < arrSize; ++i) {
        JSONElement json = arr.arrayItem(i);
        DoAddLexer(json);
    }
    CL_DEBUG("Loading JSON file...done");
}
Exemplo n.º 24
0
void FileViewer::ShowReference(const wxString& ref)
{
    const wxFileName filename = GetFilename(ref);
    wxFFile file;
    wxString data;

    if ( !filename.IsFileReadable() ||
         !file.Open(filename.GetFullPath()) ||
         !file.ReadAll(&data, wxConvAuto()) )
    {
        wxLogError(_("Error opening file %s!"), filename.GetFullPath().c_str());
        return;
    }

    m_current = ref;

    // support GNOME's xml2po's extension to references in the form of
    // filename:line(xml_node):
    wxString linenumStr = ref.AfterLast(_T(':')).BeforeFirst(_T('('));

    long linenum;
    if (!linenumStr.ToLong(&linenum))
        linenum = 0;

    m_text->SetReadOnly(false);
    m_text->SetValue(data);
    m_text->SetReadOnly(true);

    m_text->MarkerDeleteAll(1);
    m_text->MarkerAdd((int)linenum - 1, 1);

    // Center the highlighted line:
    int lineHeight = m_text->TextHeight((int)linenum);
    int linesInWnd = m_text->GetSize().y / lineHeight;
    m_text->ScrollToLine(wxMax(0, (int)linenum - linesInWnd/2));

}
bool clEditorConfig::GetSectionForFile(const wxFileName& filename, clEditorConfigSection& section)
{
    wxFileName editorConfigFile;
    if(!LoadForFile(filename, editorConfigFile)) return false;
    section = clEditorConfigSection();
    section.filename = editorConfigFile;
    bool match_found = false;
    std::for_each(m_sections.begin(), m_sections.end(), [&](const clEditorConfigSection& sec) {
        for(size_t i = 0; i < sec.patterns.size(); ++i) {
            const wxString& pattern = sec.patterns.Item(i);
            bool is_wild = pattern.Contains("*");

            wxString fullpath = filename.GetFullPath(wxPATH_UNIX);
            wxString fullname = filename.GetFullName();

            if((is_wild && ::wxMatchWild(pattern, fullpath, false)) || (!is_wild && fullname == pattern)) {
                match_found = true;
                if(sec.IsCharsetSet()) {
                    section.SetCharset(sec.GetCharset());
                }
                if(sec.IsIndentSizeSet()) {
                    section.SetIndentSize(sec.GetIndentSize());
                }
                if(sec.IsIndentStyleSet()) {
                    section.SetIndentStyle(sec.GetIndentStyle());
                }
                if(sec.IsInsertFinalNewlineSet()) {
                    section.SetInsertFinalNewline(sec.IsInsertFinalNewline());
                }
                if(sec.IsSetEndOfLineSet()) {
                    section.SetEndOfLine(sec.GetEndOfLine());
                }
                if(sec.IsTabWidthSet()) {
                    section.SetTabWidth(sec.GetTabWidth());
                }
                if(sec.IsTrimTrailingWhitespaceSet()) {
                    section.SetTrimTrailingWhitespace(sec.IsTrimTrailingWhitespace());
                }
                break;
            }
        }
    });

    // Print the match to the log file
    if(match_found) {
        section.PrintToLog();
    }
    return match_found;
}
Exemplo n.º 26
0
void
CMakePlugin::ProcessBuildEvent(clBuildEvent& event, wxString param)
{
    wxString project = event.GetProjectName();
    const wxString config  = event.GetConfigurationName();

    // Get settings
    const CMakeProjectSettings* settings = GetSettingsManager()->GetProjectSettings(project, config);

    // Doesn't exists or not enabled
    if (!settings || !settings->enabled) {
        // Unable to export makefile
        event.Skip();
        return;
    }

    // Project has parent project
    if (!settings->parentProject.IsEmpty()) {
        // Add project name as target
        param = project + " " + param;
        // Build parent project
        project = settings->parentProject;
    }

    // Workspace directory
    const wxFileName workspaceDir = GetWorkspaceDirectory();

    // Use relative path
    wxFileName projectDir = GetProjectDirectory(project);
    projectDir.MakeRelativeTo(workspaceDir.GetFullPath());

    const wxString projectDirEsc = projectDir.GetPath(wxPATH_NO_SEPARATOR, wxPATH_UNIX);

    // Build command
    wxString cmd = "$(MAKE)";

    if (!projectDirEsc.IsEmpty())
        cmd += " -C \"" + projectDirEsc + "\"";

    // Add makefile
    cmd += " -f \"" + project + ".mk\"";

    // Add optional parameters
    if (!param.IsEmpty())
        cmd += " " + param;

    // The build command is simple make call with different makefile
    event.SetCommand(cmd);
}
Exemplo n.º 27
0
bool FileUtils::ReadBufferFromFile(const wxFileName& fn, wxString& data, size_t bufferSize)
{
    if(!fn.FileExists()) { return false; }
    std::wifstream fin(fn.GetFullPath().c_str(), std::ios::binary);
    if(fin.bad()) {
        clERROR() << "Failed to open file:" << fn;
        return false;
    }

    std::vector<wchar_t> buffer(bufferSize, 0);
    if(!fin.eof()) { fin.read(buffer.data(), buffer.size()); }
    data.reserve(buffer.size());
    data << std::wstring(buffer.begin(), buffer.begin() + buffer.size());
    return true;
}
Exemplo n.º 28
0
const wxString wxExPrintHeader(const wxFileName& filename)
{
    if (filename.FileExists())
    {
        return
            wxExGetEndOfText(
                filename.GetFullPath() + " " +
                filename.GetModificationTime().Format(),
                80);
    }
    else
    {
        return _("Printed") + ": " + wxDateTime::Now().Format();
    }
}
Exemplo n.º 29
0
JSONRoot::JSONRoot(const wxFileName& filename)
    : _json(NULL)
{
    wxString content;
    wxFFile fp(filename.GetFullPath(), wxT("rb"));
    if(fp.IsOpened()) {
        if(fp.ReadAll(&content, wxConvUTF8)) {
            _json = cJSON_Parse(content.mb_str(wxConvUTF8).data());
        }
    }

    if(!_json) {
        _json = cJSON_CreateObject();
    }
}
Exemplo n.º 30
0
bool FileUtils::ReadFileUTF8(const wxFileName &fn, wxString &data)
{
	wxFFile file(fn.GetFullPath().GetData(), wxT("rb"));
	if(file.IsOpened() == false)
	{
		// Nothing to be done
		return false;
	}
	
	if( file.Length() <= 0){
		return false;
	}

	if( file.Length() > 0 ){
		data.Alloc(file.Length());
	}

	//read first two bytes to check if unicode detected
	bool isUnic(false);
	unsigned char bom[2];
	if(file.Length() >= 2){
		if(file.Read(bom, 2) == 2){
			if(bom[0] == 0xFE && bom[1] == 0xFF){
				//UTF16
				isUnic = true;
			}
		}
	}

	size_t len(file.Length());
	wxFileOffset off(0);
	if( isUnic ){
		//seek file to start to read the consumed two bytes
		len -= 2;
		off = 2;
	}

	file.Seek(off);

	char *pdata = new char[len + 1];
	file.Read(pdata, len);
	pdata[len] = 0;

	data = wxString::FromAscii(pdata);
	file.Close();
	delete [] pdata;
    return true;
}