#include "mainframe.h"

MainFrame::MainFrame( wxWindow* parent )
:
GUI_MainFrame( parent )
{

}

void MainFrame::OnCalculateClick( wxCommandEvent& event )
{
  wxArrayString output;

  if (m_fpFile->GetPath().IsEmpty())
  {
    m_tcMD5->Clear();
    return;
  }


  wxString command(wxString(wxT("md5sum ")) + m_fpFile->GetPath());

  if (wxExecute(command,output) == 0 && output.Count() > 0)
    m_tcMD5->SetValue(output[0].BeforeFirst(wxChar(' ')));
  else
    m_tcMD5->Clear();
}

void MainFrame::OnExitClick( wxCommandEvent& event )
{
  Close();
}

