summaryrefslogtreecommitdiff
path: root/support/dktools/Dk4FcsFrame.cpp
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/dktools/Dk4FcsFrame.cpp
Initial commit
Diffstat (limited to 'support/dktools/Dk4FcsFrame.cpp')
-rw-r--r--support/dktools/Dk4FcsFrame.cpp1122
1 files changed, 1122 insertions, 0 deletions
diff --git a/support/dktools/Dk4FcsFrame.cpp b/support/dktools/Dk4FcsFrame.cpp
new file mode 100644
index 0000000000..9ece3feffb
--- /dev/null
+++ b/support/dktools/Dk4FcsFrame.cpp
@@ -0,0 +1,1122 @@
+/*
+ WARNING: This file was generated by dkct.
+ Changes you make here will be lost if dkct is run again!
+ You should modify the original source and run dkct on it.
+ Original source: Dk4FcsFrame.wxc
+*/
+
+/*
+Copyright (C) 2015-2017, Dirk Krause
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above opyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* Neither the name of the author nor the names of contributors may be used
+ to endorse or promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/** @file Dk4FcsFrame.cpp The Dk4FcsFrame module.
+*/
+
+
+#line 246 "Dk4FcsFrame.wxc"
+
+#include "wxdkfcs.h"
+
+#include "dk4mem.h"
+
+#include "dk4verswx.h"
+
+
+#if DK4_HAVE_OPENSSL_MD5_H
+#ifndef OPENSSL_MD5_H_INCLUDED
+#include <openssl/md5.h>
+#define OPENSSL_MD5_H_INCLUDED 1
+#endif
+#endif
+#if DK4_HAVE_OPENSSL_RIPEMD_H
+#ifndef OPENSSL_RIPEMD_H_INCLUDED
+#include <openssl/ripemd.h>
+#define OPENSSL_RIPEMD_H_INCLUDED 1
+#endif
+#endif
+#if DK4_HAVE_OPENSSL_SHA_H
+#ifndef OPENSSL_SHA_H_INCLUDED
+#include <openssl/sha.h>
+#define OPENSSL_SHA_H_INCLUDED 1
+#endif
+#endif
+
+#if !defined(__WXMSW__)
+#include "dkicon.xpm"
+#endif
+
+
+
+
+
+#line 280 "Dk4FcsFrame.wxc"
+
+
+
+BEGIN_EVENT_TABLE(Dk4FcsFrame, wxFrame)
+ EVT_MENU(Dk4FcsFrame_Quit, Dk4FcsFrame::OnQuit)
+ EVT_MENU(Dk4FcsFrame_Open, Dk4FcsFrame::OnOpen)
+ EVT_MENU(Dk4FcsFrame_Help_About, Dk4FcsFrame::OnAbout)
+ EVT_MENU(Dk4FcsFrame_Help_Contents, Dk4FcsFrame::OnHelpContents)
+ EVT_IDLE(Dk4FcsFrame::OnIdle)
+END_EVENT_TABLE()
+
+
+
+typedef struct {
+/*
+ Message digests contexts.
+*/
+#if DK4_HAVE_OPENSSL_MD5_H
+ MD5_CTX md5; /**< MD5 context. */
+#endif
+#if DK4_HAVE_OPENSSL_RIPEMD_H
+ RIPEMD160_CTX ripemd160; /**< RIPEMD-160 context. */
+#endif
+#if DK4_HAVE_OPENSSL_SHA_H
+ SHA_CTX sha; /**< SHA-1 context. */
+#if DK4_HAVE_SHA224
+ SHA256_CTX sha224; /**< SHA-224 context. */
+#endif
+#if DK4_HAVE_SHA256
+ SHA256_CTX sha256; /**< SHA-256 context. */
+#endif
+#if DK4_HAVE_SHA384
+ SHA512_CTX sha384; /**< SHA-384 context. */
+#endif
+#if DK4_HAVE_SHA512
+ SHA512_CTX sha512; /**< SHA-512 context. */
+#endif
+#endif
+ int iMd5; /**< Flag: Can use Md5. */
+ int iRipemd160; /**< Flag: Can use RIPEMD-160. */
+ int iSha1; /**< Flag: Can use SHA-1. */
+ int iSha224; /**< Flag: Can use SHA-224. */
+ int iSha256; /**< Flag: Can use SHA-256. */
+ int iSha384; /**< Flag: Can use SHA-384. */
+ int iSha512; /**< Flag: Can use SHA-512. */
+} MULTI_CTX;
+
+
+
+static const wxChar dk4fcs_frame_version[] = { DKT_VERSION_WX };
+
+
+
+static
+void
+multi_ctx_init(MULTI_CTX *mptr)
+{
+
+
+#line 338 "Dk4FcsFrame.wxc"
+ DK4_MEMRES(mptr, sizeof(MULTI_CTX));
+#if DK4_HAVE_OPENSSL_MD5_H
+ if (1 == MD5_Init(&(mptr->md5))) {
+ mptr->iMd5 = 1;
+
+#line 342 "Dk4FcsFrame.wxc"
+ }
+#endif
+#if DK4_HAVE_OPENSSL_RIPEMD_H
+ if (1 == RIPEMD160_Init(&(mptr->ripemd160))) {
+ mptr->iRipemd160 = 1;
+
+#line 347 "Dk4FcsFrame.wxc"
+ }
+#endif
+#if DK4_HAVE_OPENSSL_SHA_H
+ if (1 == SHA1_Init(&(mptr->sha))) {
+ mptr->iSha1 = 1;
+
+#line 352 "Dk4FcsFrame.wxc"
+ }
+#if DK4_HAVE_SHA224
+ if (1 == SHA224_Init(&(mptr->sha224))) {
+ mptr->iSha224 = 1;
+
+#line 356 "Dk4FcsFrame.wxc"
+ }
+#endif
+#if DK4_HAVE_SHA256
+ if (1 == SHA256_Init(&(mptr->sha256))) {
+ mptr->iSha256 = 1;
+
+#line 361 "Dk4FcsFrame.wxc"
+ }
+#endif
+#if DK4_HAVE_SHA384
+ if (1 == SHA384_Init(&(mptr->sha384))) {
+ mptr->iSha384 = 1;
+
+#line 366 "Dk4FcsFrame.wxc"
+ }
+#endif
+#if DK4_HAVE_SHA512
+ if (1 == SHA512_Init(&(mptr->sha512))) {
+ mptr->iSha512 = 1;
+
+#line 371 "Dk4FcsFrame.wxc"
+ }
+#endif
+#endif
+
+
+#line 375 "Dk4FcsFrame.wxc"
+}
+
+
+
+static
+void
+multi_ctx_add(MULTI_CTX *mptr, void *buffer, size_t sz)
+{
+
+
+#line 384 "Dk4FcsFrame.wxc"
+#if DK4_HAVE_OPENSSL_MD5_H
+ if (1 != MD5_Update(&(mptr->md5), buffer, (unsigned long)sz)) {
+ mptr->iMd5 = 0;
+
+#line 387 "Dk4FcsFrame.wxc"
+ }
+#endif
+#if DK4_HAVE_OPENSSL_RIPEMD_H
+ if (1 != RIPEMD160_Update(&(mptr->ripemd160), buffer, (unsigned long)sz)) {
+ mptr->iRipemd160 = 0;
+
+#line 392 "Dk4FcsFrame.wxc"
+ }
+#endif
+#if DK4_HAVE_OPENSSL_SHA_H
+ if (1 != SHA1_Update(&(mptr->sha), buffer, (unsigned long)sz)) {
+ mptr->iSha1 = 0;
+
+#line 397 "Dk4FcsFrame.wxc"
+ }
+#if DK4_HAVE_SHA224
+ if (1 != SHA224_Update(&(mptr->sha224), buffer, (unsigned long)sz)) {
+ mptr->iSha224 = 0;
+
+#line 401 "Dk4FcsFrame.wxc"
+ }
+#endif
+#if DK4_HAVE_SHA256
+ if (1 != SHA256_Update(&(mptr->sha256), buffer, (unsigned long)sz)) {
+ mptr->iSha256 = 0;
+
+#line 406 "Dk4FcsFrame.wxc"
+ }
+#endif
+#if DK4_HAVE_SHA384
+ if (1 != SHA384_Update(&(mptr->sha384), buffer, (unsigned long)sz)) {
+ mptr->iSha384 = 0;
+
+#line 411 "Dk4FcsFrame.wxc"
+ }
+#endif
+#if DK4_HAVE_SHA512
+ if (1 != SHA512_Update(&(mptr->sha512), buffer, (unsigned long)sz)) {
+ mptr->iSha512 = 0;
+
+#line 416 "Dk4FcsFrame.wxc"
+ }
+#endif
+#endif
+
+
+#line 420 "Dk4FcsFrame.wxc"
+}
+
+
+
+/** Thread runs while progress dialog is shown.
+ This is a ``fire and forget'' thread destroying itself after running.
+*/
+class Dk4FcsThread : public wxThread
+{
+ protected:
+
+ /** Buffer for reading input file.
+ */
+ unsigned char buf[4096];
+
+ /** Progress dialog.
+ */
+ Dk4WxProgressDialog *pPd;
+
+ /** Multiple message digest contexts.
+ */
+ MULTI_CTX *pCtx;
+
+ /** File to read from.
+ */
+ wxFile *pWxf;
+
+ public:
+
+ /** Constructor.
+ @param pd Pointer to progress dialog.
+ @param ctx Pointer to multiple digest contexts collection.
+ @param wxf Pointer to file we read from.
+ */
+ Dk4FcsThread(
+ Dk4WxProgressDialog *pd,
+ MULTI_CTX *ctx,
+ wxFile *wxf
+ );
+
+ /** Thread function.
+ @return Pointer which is ignored.
+ */
+ virtual
+ void *
+ Entry();
+
+ /** Method executed at end of thread.
+ */
+ virtual
+ void
+ OnExit();
+};
+
+
+
+Dk4FcsThread::Dk4FcsThread(
+ Dk4WxProgressDialog *pd,
+ MULTI_CTX *ctx,
+ wxFile *wxf
+)
+{
+
+
+#line 483 "Dk4FcsFrame.wxc"
+ pPd = pd;
+ pCtx = ctx;
+ pWxf = wxf;
+
+
+#line 487 "Dk4FcsFrame.wxc"
+}
+
+
+
+void *
+Dk4FcsThread::Entry()
+{
+ wxFileOffset fileSize = (wxFileOffset)0UL;
+ wxFileOffset bytesRead = (wxFileOffset)0UL;
+ size_t bytes = 0U;
+ int gauge = 0;
+ int ogauge = 0;
+ bool canContinue = true;
+ bool success = true;
+
+
+#line 502 "Dk4FcsFrame.wxc"
+ fileSize = pWxf->Length();
+ while(canContinue) {
+
+#line 504 "Dk4FcsFrame.wxc"
+ if (pPd->CanContinue()) {
+
+#line 505 "Dk4FcsFrame.wxc"
+ bytes = pWxf->Read(buf, sizeof(buf));
+
+
+#line 507 "Dk4FcsFrame.wxc"
+ if (0 < bytes) {
+
+#line 508 "Dk4FcsFrame.wxc"
+ if ((size_t)(wxInvalidOffset) != bytes) {
+
+#line 509 "Dk4FcsFrame.wxc"
+ multi_ctx_add(pCtx, buf, bytes);
+ bytesRead += (wxFileOffset)bytes;
+ if (bytesRead >= fileSize) {
+ gauge = 1000;
+
+#line 513 "Dk4FcsFrame.wxc"
+ } else {
+ gauge = (int)((1000.0 * (double)bytesRead) / ((double)fileSize));
+ if (1000 < gauge) {
+ gauge = 1000;
+
+#line 517 "Dk4FcsFrame.wxc"
+ }
+ }
+ if (gauge != ogauge) {
+
+#line 520 "Dk4FcsFrame.wxc"
+ pPd->SetGauge(gauge);
+ ogauge = gauge;
+ }
+ } else {
+
+#line 524 "Dk4FcsFrame.wxc"
+ canContinue = false;
+ success = false;
+ }
+ } else {
+
+#line 528 "Dk4FcsFrame.wxc"
+ canContinue = false;
+ }
+ } else {
+
+#line 531 "Dk4FcsFrame.wxc"
+ canContinue = false;
+ success = false;
+ }
+
+#line 534 "Dk4FcsFrame.wxc"
+ }
+
+
+#line 536 "Dk4FcsFrame.wxc"
+ pPd->EndProcessing(success);
+
+
+#line 538 "Dk4FcsFrame.wxc"
+ return NULL;
+}
+
+
+
+void
+Dk4FcsThread::OnExit()
+{
+
+
+#line 547 "Dk4FcsFrame.wxc"
+
+
+#line 548 "Dk4FcsFrame.wxc"
+}
+
+
+
+
+#line 553 "Dk4FcsFrame.wxc"
+Dk4FcsFrame::Dk4FcsFrame(
+ int wxid,
+ Dk4WxApplicationHelper *applicationHelper,
+ Dk4WxHelpController *hc,
+ int argc,
+ wxChar **argv,
+ wxChar const * const *localizedTexts,
+ wxChar const * const *nlWx,
+ dkChar const * const *nlDk
+) : Dk4WxFrame(nlWx[0], applicationHelper, hc, wxid)
+{
+
+
+#line 565 "Dk4FcsFrame.wxc"
+ /* Further local variables.
+ */
+
+ /* Initialize further local variables.
+ */
+
+ sTexts = localizedTexts;
+ sNlWx = nlWx;
+ sNlDk = nlDk;
+#if defined(__WXMSW__)
+ wxIcon wxdkfcs_icon(sNlWx[4]);
+#else
+ wxIcon wxdkfcs_icon(xpm_dkicon);
+#endif
+ /* Initialize further class members.
+ */
+ bActive = true;
+ sFileName = wxEmptyString;
+ sDirectory = wxEmptyString;
+ if (1 < argc) {
+ sFileName = argv[1];
+ oAsc.SetAutoStart(true);
+ {
+ wxFileName wxfn(sFileName);
+ sDirectory = wxfn.GetPath();
+ }
+#if 0
+ /* Just to test auto exit.
+ */
+ oAsc.SetAutoExit(true);
+#endif
+ }
+ dkctGUILayoutOK = false;
+ dkctGUIContentsPanel = NULL;
+ mainSizer = NULL;
+ mbMain = NULL;
+ menuFile = NULL;
+ menuHelp = NULL;
+ miFileOpen = NULL;
+ miFileExit = NULL;
+ miHelpAbout = NULL;
+ miHelpContents = NULL;
+ verticalSizer = NULL;
+ contentsSizer = NULL;
+ lFile = NULL;
+ tFile = NULL;
+ gResults = NULL;
+ dkctGUIContentsPanel = new wxPanel(this);
+ if(!(dkctGUIContentsPanel)) {
+ goto dkctGUILayoutFinished;
+ }
+#if wxUSE_MENUS
+ mbMain = new wxMenuBar(
+ );
+ if(!(mbMain)) {
+ goto dkctGUILayoutFinished;
+ }
+ menuFile = new wxMenu(
+ );
+ if(!(menuFile)) {
+ goto dkctGUILayoutFinished;
+ }
+ miFileOpen = menuFile->Append(
+ Dk4FcsFrame_Open,
+ sTexts[23],
+ sTexts[24]
+ );
+ if(!(miFileOpen)) {
+ goto dkctGUILayoutFinished;
+ }
+ miFileExit = menuFile->Append(
+ Dk4FcsFrame_Quit,
+ sTexts[1],
+ sTexts[2]
+ );
+ if(!(miFileExit)) {
+ goto dkctGUILayoutFinished;
+ }
+ mbMain->Append(menuFile, sTexts[0]);
+ menuHelp = new wxMenu(
+ );
+ if(!(menuHelp)) {
+ goto dkctGUILayoutFinished;
+ }
+ miHelpAbout = menuHelp->Append(
+ Dk4FcsFrame_Help_About,
+ sTexts[4],
+ sTexts[5]
+ );
+ if(!(miHelpAbout)) {
+ goto dkctGUILayoutFinished;
+ }
+ miHelpContents = menuHelp->Append(
+ Dk4FcsFrame_Help_Contents,
+ sTexts[6],
+ sTexts[7]
+ );
+ if(!(miHelpContents)) {
+ goto dkctGUILayoutFinished;
+ }
+ mbMain->Append(menuHelp, sTexts[3]);
+ SetMenuBar(mbMain);
+#endif
+ mainSizer = new wxBoxSizer(
+ wxHORIZONTAL
+ );
+ if(!(mainSizer)) {
+ goto dkctGUILayoutFinished;
+ }
+ mainSizer->Add(10, 10, 0);
+ verticalSizer = new wxBoxSizer(
+ wxVERTICAL
+ );
+ if(!(verticalSizer)) {
+ goto dkctGUILayoutFinished;
+ }
+ verticalSizer->Add(10, 10, 0);
+ contentsSizer = new wxGridBagSizer(
+ 5, 5
+ );
+ if(!(contentsSizer)) {
+ goto dkctGUILayoutFinished;
+ }
+ lFile = new wxStaticText(
+ dkctGUIContentsPanel,
+ wxID_ANY,
+ sTexts[13]
+ );
+ if(!(lFile)) {
+ goto dkctGUILayoutFinished;
+ }
+ contentsSizer->Add(
+ lFile,
+ wxGBPosition(0, 0),
+ wxGBSpan(1, 1),
+ wxALIGN_RIGHT
+ );
+ tFile = new wxStaticText(
+ dkctGUIContentsPanel,
+ wxID_ANY,
+ wxT("")
+ );
+ if(!(tFile)) {
+ goto dkctGUILayoutFinished;
+ }
+ contentsSizer->Add(
+ tFile,
+ wxGBPosition(0, 1),
+ wxGBSpan(1, 1),
+ wxALIGN_LEFT
+ );
+ gResults = new wxGrid(
+ dkctGUIContentsPanel,
+ wxID_ANY
+ );
+ if(!(gResults)) {
+ goto dkctGUILayoutFinished;
+ }
+ gResults->CreateGrid(7, 1);
+ gResults->SetColLabelValue(0, sTexts[21]);
+ gResults->SetRowLabelValue(0, sTexts[14]);
+ gResults->SetRowLabelValue(1, sTexts[15]);
+ gResults->SetRowLabelValue(2, sTexts[16]);
+ gResults->SetRowLabelValue(3, sTexts[17]);
+ gResults->SetRowLabelValue(4, sTexts[18]);
+ gResults->SetRowLabelValue(5, sTexts[19]);
+ gResults->SetRowLabelValue(6, sTexts[20]);
+ gResults->SetCellValue(0, 0, sNlWx[17]);
+ gResults->SetCellValue(1, 0, sNlWx[17]);
+ gResults->SetCellValue(2, 0, sNlWx[17]);
+ gResults->SetCellValue(3, 0, sNlWx[17]);
+ gResults->SetCellValue(4, 0, sNlWx[17]);
+ gResults->SetCellValue(5, 0, sNlWx[17]);
+ gResults->SetCellValue(6, 0, sNlWx[17]);
+ gResults->SetRowLabelSize(wxGRID_AUTOSIZE);
+ gResults->SetColLabelSize(wxGRID_AUTOSIZE);
+ gResults->AutoSize();
+ gResults->EnableEditing(false);
+ gResults->SetMinSize(wxSize(300, 200));
+ contentsSizer->Add(
+ gResults,
+ wxGBPosition(1, 0),
+ wxGBSpan(1, 2),
+ wxALIGN_LEFT|wxGROW
+ );
+ contentsSizer->AddGrowableRow(1);
+ contentsSizer->AddGrowableCol(1);
+ verticalSizer->Add(
+ contentsSizer,
+ 1,
+ wxGROW
+ );
+ verticalSizer->Add(10, 10, 0);
+ mainSizer->Add(
+ verticalSizer,
+ 1,
+ wxGROW
+ );
+ mainSizer->Add(10, 10, 0);
+ dkctGUIContentsPanel->SetSizer(mainSizer);
+ SetIcon(wxdkfcs_icon);
+ dkctGUILayoutOK = true;
+ dkctGUILayoutFinished:
+#if wxUSE_STATUSBAR
+ if(dkctGUILayoutOK) {
+ CreateStatusBar(1);
+ SetStatusText(sTexts[8]);
+ }
+#endif
+ if(dkctGUILayoutOK) {
+ mainSizer->Fit(this);
+ mainSizer->SetSizeHints(this);
+ }
+
+#line 598 "Dk4FcsFrame.wxc"
+ if(dkctGUILayoutOK) {
+ SetTitle(nlWx[0]);
+ if (1 < argc) {
+ tFile->SetLabel(sFileName);
+ }
+#if 0
+ RestorePosition();
+#endif
+ gResults->SetCellValue(0, 0, sNlWx[5]);
+ gResults->SetCellValue(1, 0, sNlWx[5]);
+ gResults->SetCellValue(2, 0, sNlWx[5]);
+ gResults->SetCellValue(3, 0, sNlWx[5]);
+ gResults->SetCellValue(4, 0, sNlWx[5]);
+ gResults->SetCellValue(5, 0, sNlWx[5]);
+ gResults->SetCellValue(6, 0, sNlWx[5]);
+ }
+
+ /* Release resources allocated by local variables.
+ */
+
+
+#line 618 "Dk4FcsFrame.wxc"
+}
+
+
+#line 621 "Dk4FcsFrame.wxc"
+
+
+
+Dk4FcsFrame::~Dk4FcsFrame()
+{
+
+
+#line 627 "Dk4FcsFrame.wxc"
+ /* Release resources allocated by further class members.
+ */
+
+
+#line 630 "Dk4FcsFrame.wxc"
+}
+
+
+
+bool
+Dk4FcsFrame::CanClose(bool isFinal)
+{
+ bool back = true;
+
+
+#line 639 "Dk4FcsFrame.wxc"
+
+
+#line 640 "Dk4FcsFrame.wxc"
+ return back;
+}
+
+
+
+void
+Dk4FcsFrame::OnQuit(wxCommandEvent & event)
+{
+
+
+#line 649 "Dk4FcsFrame.wxc"
+ Close();
+
+
+#line 651 "Dk4FcsFrame.wxc"
+}
+
+
+
+void
+Dk4FcsFrame::OnAbout(wxCommandEvent & event)
+{
+ wxString text(wxT(""));
+ wxString title(wxT(""));
+
+
+#line 661 "Dk4FcsFrame.wxc"
+ /* Construct message text. */
+ text.Append(sNlWx[0]);
+ text.Append(sNlWx[7]);
+ text.Append(dk4fcs_frame_version);
+#if 0
+ text.Append(sNlWx[1]);
+#endif
+ text.Append(sNlWx[8]);
+ text.Append(sTexts[9]);
+ text.Append(sNlWx[2]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[8]);
+ text.Append(sTexts[11]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[9]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[8]);
+ text.Append(sTexts[12]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[10]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[11]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[12]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[13]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[14]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[15]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[16]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[18]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[19]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[20]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[21]);
+ text.Append(sNlWx[8]);
+ text.Append(sNlWx[22]);
+
+ /* Construct dialog box title. */
+ title.Append(sTexts[10]);
+ title.Append(sNlWx[0]);
+
+ /* Show dialog box. */
+ wxMessageBox(text, title);
+
+
+#line 712 "Dk4FcsFrame.wxc"
+}
+
+
+
+void
+Dk4FcsFrame::OnHelpContents(wxCommandEvent & event)
+{
+
+
+#line 720 "Dk4FcsFrame.wxc"
+ DisplayContents();
+
+
+#line 722 "Dk4FcsFrame.wxc"
+}
+
+
+
+/* __CHANGE__ 017: Event handlers for further events.
+*/
+
+
+
+/** Hexadecimal digits.
+*/
+static const wxChar hexdig[] = { wxT("0123456789abcdef") };
+
+
+
+void
+Dk4FcsFrame::SetCellValueBinary(
+ int rowno,
+ unsigned char *buf,
+ size_t bytes
+)
+{
+ wxChar obuf[144];
+ wxChar *obptr;
+ unsigned short u;
+
+
+#line 748 "Dk4FcsFrame.wxc"
+ if (64 >= bytes) {
+ obptr = obuf;
+ while(bytes--) {
+ u = (unsigned short)(*buf);
+ u = u >> 4;
+ u &= 15;
+ *(obptr++) = hexdig[u];
+
+#line 755 "Dk4FcsFrame.wxc"
+ u = (unsigned short)(*buf);
+ u &= 15;
+ *(obptr++) = hexdig[u];
+
+#line 758 "Dk4FcsFrame.wxc"
+ buf++;
+ }
+ *obptr = wxT('\0');
+ {
+ wxString testString(obuf);
+ gResults->SetCellValue(rowno, 0, testString);
+ }
+ } else {
+ /* ERROR: message digest too long, need larger obuf! */
+ }
+
+
+#line 769 "Dk4FcsFrame.wxc"
+}
+
+
+
+bool
+Dk4FcsFrame::RunChecksumming(void)
+{
+ MULTI_CTX ctx; // Digests contexts collection
+ unsigned char obuf[128]; // Binary message digests
+ Dk4WxProgressDialog *pd = NULL; // Progress dialog
+ Dk4FcsThread *pt = NULL; // Thread
+ int res = 0; // Operation result
+ bool updateTable = false; // Flag: Update the table
+
+
+#line 783 "Dk4FcsFrame.wxc"
+ /* Reset all values.
+ */
+ gResults->BeginBatch();
+ gResults->SetCellValue(0, 0, sNlWx[5]);
+ gResults->SetCellValue(1, 0, sNlWx[5]);
+ gResults->SetCellValue(2, 0, sNlWx[5]);
+ gResults->SetCellValue(3, 0, sNlWx[5]);
+ gResults->SetCellValue(4, 0, sNlWx[5]);
+ gResults->SetCellValue(5, 0, sNlWx[5]);
+ gResults->SetCellValue(6, 0, sNlWx[5]);
+ gResults->EndBatch();
+ gResults->ForceRefresh();
+ Refresh();
+ Update();
+
+ /* Attempt to build checksum.
+ */
+ if (wxFile::Exists(sFileName)) {
+
+#line 801 "Dk4FcsFrame.wxc"
+ {
+ wxFile wxf(sFileName);
+ if (wxf.IsOpened()) {
+
+#line 804 "Dk4FcsFrame.wxc"
+ pd = new Dk4WxProgressDialog(this, pAppHelp);
+ if (NULL != pd) {
+
+#line 806 "Dk4FcsFrame.wxc"
+ pt = new Dk4FcsThread(pd, &ctx, &wxf);
+ if (NULL != pt) {
+
+#line 808 "Dk4FcsFrame.wxc"
+ multi_ctx_init(&ctx);
+ if(wxTHREAD_NO_ERROR == pt->Create()) {
+
+#line 810 "Dk4FcsFrame.wxc"
+ pt->SetPriority(WXTHREAD_DEFAULT_PRIORITY);
+ pt->Run();
+ res = pd->ShowModal();
+ if (wxID_OK == res) {
+
+#line 814 "Dk4FcsFrame.wxc"
+ updateTable = true;
+ } else {
+
+#line 816 "Dk4FcsFrame.wxc"
+ /* !!!!! ERROR: Aborted by user */
+ }
+ } else {
+
+#line 819 "Dk4FcsFrame.wxc"
+ delete(pt);
+ pt = NULL;
+ /* !!!!! ERROR: Failed to create thread */
+ }
+ } else {
+
+#line 824 "Dk4FcsFrame.wxc"
+ /* !!!!! ERROR: No thread */
+ }
+ pd->Destroy();
+ } else {
+
+#line 828 "Dk4FcsFrame.wxc"
+ /* !!!!! ERROR: No progress dialog */
+ }
+ } else {
+
+#line 831 "Dk4FcsFrame.wxc"
+ /* !!!!! ERROR: Failed to open file */
+ }
+ }
+ if (updateTable) {
+
+#line 835 "Dk4FcsFrame.wxc"
+ gResults->BeginBatch();
+#if DK4_HAVE_OPENSSL_MD5_H
+ if (0 != ctx.iMd5) {
+
+#line 838 "Dk4FcsFrame.wxc"
+ if (1 == MD5_Final(obuf, &(ctx.md5))) {
+
+#line 839 "Dk4FcsFrame.wxc"
+ SetCellValueBinary(0, obuf, 16);
+ }
+ }
+#endif
+#if DK4_HAVE_OPENSSL_RIPEMD_H
+ if (0 != ctx.iRipemd160) {
+
+#line 845 "Dk4FcsFrame.wxc"
+ if (1 == RIPEMD160_Final(obuf, &(ctx.ripemd160))) {
+ SetCellValueBinary(1, obuf, 20);
+
+#line 847 "Dk4FcsFrame.wxc"
+ }
+ }
+#endif
+#if DK4_HAVE_OPENSSL_SHA_H
+ if (0 != ctx.iSha1) {
+
+#line 852 "Dk4FcsFrame.wxc"
+ if (1 == SHA1_Final(obuf, &(ctx.sha))) {
+
+#line 853 "Dk4FcsFrame.wxc"
+ SetCellValueBinary(2, obuf, 20);
+ }
+ }
+#if DK4_HAVE_SHA224
+ if (0 != ctx.iSha224) {
+
+#line 858 "Dk4FcsFrame.wxc"
+ if (1 == SHA224_Final(obuf, &(ctx.sha224))) {
+
+#line 859 "Dk4FcsFrame.wxc"
+ SetCellValueBinary(3, obuf, 28);
+ }
+ }
+#endif
+#if DK4_HAVE_SHA256
+ if (0 != ctx.iSha256) {
+
+#line 865 "Dk4FcsFrame.wxc"
+ if (1 == SHA256_Final(obuf, &(ctx.sha256))) {
+
+#line 866 "Dk4FcsFrame.wxc"
+ SetCellValueBinary(4, obuf, 32);
+ }
+ }
+#endif
+#if DK4_HAVE_SHA384
+ if (0 != ctx.iSha384) {
+
+#line 872 "Dk4FcsFrame.wxc"
+ if (1 == SHA384_Final(obuf, &(ctx.sha384))) {
+
+#line 873 "Dk4FcsFrame.wxc"
+ SetCellValueBinary(5, obuf, 48);
+ }
+ }
+#endif
+#if DK4_HAVE_SHA512
+ if (0 != ctx.iSha512) {
+
+#line 879 "Dk4FcsFrame.wxc"
+ if (1 == SHA512_Final(obuf, &(ctx.sha512))) {
+
+#line 880 "Dk4FcsFrame.wxc"
+ SetCellValueBinary(6, obuf, 64);
+ }
+ }
+#endif
+#endif
+ gResults->AutoSize();
+ gResults->EndBatch();
+ gResults->ForceRefresh();
+ {
+ int x, y, w, h;
+ GetPosition(&x, &y);
+ GetSize(&w, &h);
+ mainSizer->Fit(this);
+ SetSize(x, y, w, h);
+ }
+ Refresh();
+ Update();
+ } else {
+
+#line 898 "Dk4FcsFrame.wxc"
+ }
+ } else {
+
+#line 900 "Dk4FcsFrame.wxc"
+ /* !!!!! ERROR: File does not exist */
+ }
+
+
+#line 903 "Dk4FcsFrame.wxc"
+ return updateTable;
+}
+
+
+
+void
+Dk4FcsFrame::OnOpen(wxCommandEvent & event)
+{
+ bool canRun = true;
+ int res = 0;
+
+
+#line 914 "Dk4FcsFrame.wxc"
+ {
+ wxFileDialog dlg(this, sTexts[22], sDirectory);
+ res = dlg.ShowModal();
+ if (wxID_OK == res) {
+ sFileName = dlg.GetPath();
+ tFile->SetLabel(sFileName);
+ {
+ wxFileName wxfn(sFileName);
+ sDirectory = wxfn.GetPath();
+ }
+ canRun = true;
+ } else {
+ canRun = false;
+ }
+ }
+ if (canRun) {
+ (void)RunChecksumming();
+ }
+
+
+#line 933 "Dk4FcsFrame.wxc"
+}
+
+
+
+void
+Dk4FcsFrame::OnIdle(wxIdleEvent & event)
+{
+ bool success = false;
+
+
+#line 942 "Dk4FcsFrame.wxc"
+ if (bActive) {
+ /* event.RequestMore(); */
+ switch (oAsc.GetReaction()) {
+#if 0
+ case DK4WX_AUTOSTART_REACTION_IGNORE : {
+ } break;
+#endif
+ case DK4WX_AUTOSTART_REACTION_START : {
+ oAsc.StartProcessing();
+ success = RunChecksumming();
+ oAsc.EndProcessing(success);
+ } break;
+ case DK4WX_AUTOSTART_REACTION_MORE : {
+ event.RequestMore();
+ } break;
+ case DK4WX_AUTOSTART_REACTION_EXIT : {
+ bActive = false;
+ Close();
+ } break;
+ }
+ }
+ event.Skip();
+
+
+#line 965 "Dk4FcsFrame.wxc"
+}
+
+