Skip to content
Permalink
Browse files

Added source code to DBP IDE. You will need a legacy version of the B…

…CG API to complete the compile, as we are unable to release this as open source. Alternatively the BCG dependence could be removed or amended to support the latest version of BCG currently available.
  • Loading branch information...
LeeBamberTGC
LeeBamberTGC committed Feb 14, 2016
1 parent 210254b commit acb03d050f20a6aaaba22591cdeb6d71429ba31c
Showing with 27,905 additions and 0 deletions.
  1. +32 −0 Synergy Editor TGC/Synergy Editor.sln
  2. +128 −0 Synergy Editor TGC/Synergy Editor/AdBanner.cpp
  3. +29 −0 Synergy Editor TGC/Synergy Editor/AdBanner.h
  4. +165 −0 Synergy Editor TGC/Synergy Editor/AdvertThread.cpp
  5. +17 −0 Synergy Editor TGC/Synergy Editor/AdvertThread.h
  6. +70 −0 Synergy Editor TGC/Synergy Editor/ChildFrm.cpp
  7. +36 −0 Synergy Editor TGC/Synergy Editor/ChildFrm.h
  8. +411 −0 Synergy Editor TGC/Synergy Editor/ClassView.cpp
  9. +76 −0 Synergy Editor TGC/Synergy Editor/ClassView.h
  10. +328 −0 Synergy Editor TGC/Synergy Editor/CompileSupport.cpp
  11. +14 −0 Synergy Editor TGC/Synergy Editor/CompileSupport.h
  12. +302 −0 Synergy Editor TGC/Synergy Editor/CursorBar.cpp
  13. +52 −0 Synergy Editor TGC/Synergy Editor/CursorBar.h
  14. +277 −0 Synergy Editor TGC/Synergy Editor/Doc.cpp
  15. +51 −0 Synergy Editor TGC/Synergy Editor/Doc.h
  16. +163 −0 Synergy Editor TGC/Synergy Editor/Editor.ini
  17. +2,601 −0 Synergy Editor TGC/Synergy Editor/EditorControl.cpp
  18. +92 −0 Synergy Editor TGC/Synergy Editor/EditorControl.h
  19. +43 −0 Synergy Editor TGC/Synergy Editor/ExtendedFind.cpp
  20. +29 −0 Synergy Editor TGC/Synergy Editor/ExtendedFind.h
  21. +34 −0 Synergy Editor TGC/Synergy Editor/ExtendedReplace.cpp
  22. +448 −0 Synergy Editor TGC/Synergy Editor/FindInProjectDialog.cpp
  23. +50 −0 Synergy Editor TGC/Synergy Editor/FindInProjectDialog.h
  24. +42 −0 Synergy Editor TGC/Synergy Editor/GotoLineDlg.cpp
  25. +48 −0 Synergy Editor TGC/Synergy Editor/GotoLineDlg.h
  26. +82 −0 Synergy Editor TGC/Synergy Editor/HTMLDocument.cpp
  27. +42 −0 Synergy Editor TGC/Synergy Editor/HTMLDocument.h
  28. +100 −0 Synergy Editor TGC/Synergy Editor/HTMLViewCustom.cpp
  29. +32 −0 Synergy Editor TGC/Synergy Editor/HTMLViewCustom.h
  30. +285 −0 Synergy Editor TGC/Synergy Editor/HTTPComm.cpp
  31. +8 −0 Synergy Editor TGC/Synergy Editor/HTTPComm.h
  32. +262 −0 Synergy Editor TGC/Synergy Editor/Help.cpp
  33. +60 −0 Synergy Editor TGC/Synergy Editor/Help.h
  34. +78 −0 Synergy Editor TGC/Synergy Editor/ImageChild.cpp
  35. +30 −0 Synergy Editor TGC/Synergy Editor/ImageChild.h
  36. +107 −0 Synergy Editor TGC/Synergy Editor/ImagePreviewStatic.cpp
  37. +29 −0 Synergy Editor TGC/Synergy Editor/ImagePreviewStatic.h
  38. +90 −0 Synergy Editor TGC/Synergy Editor/ImageWindow.cpp
  39. +41 −0 Synergy Editor TGC/Synergy Editor/ImageWindow.h
  40. +64 −0 Synergy Editor TGC/Synergy Editor/InputDialog.cpp
  41. +34 −0 Synergy Editor TGC/Synergy Editor/InputDialog.h
  42. +120 −0 Synergy Editor TGC/Synergy Editor/KeystateChild.cpp
  43. +39 −0 Synergy Editor TGC/Synergy Editor/KeystateChild.h
  44. +95 −0 Synergy Editor TGC/Synergy Editor/KeystateWindow.cpp
  45. +40 −0 Synergy Editor TGC/Synergy Editor/KeystateWindow.h
  46. +10 −0 Synergy Editor TGC/Synergy Editor/Keyword.cpp
  47. +12 −0 Synergy Editor TGC/Synergy Editor/Keyword.h
  48. +70 −0 Synergy Editor TGC/Synergy Editor/KeywordDialog.cpp
  49. +33 −0 Synergy Editor TGC/Synergy Editor/KeywordDialog.h
  50. +652 −0 Synergy Editor TGC/Synergy Editor/Keywords.cpp
  51. +53 −0 Synergy Editor TGC/Synergy Editor/Keywords.h
  52. +1,791 −0 Synergy Editor TGC/Synergy Editor/MainFrm.cpp
  53. +182 −0 Synergy Editor TGC/Synergy Editor/MainFrm.h
  54. +347 −0 Synergy Editor TGC/Synergy Editor/MediaBar.cpp
  55. +72 −0 Synergy Editor TGC/Synergy Editor/MediaBar.h
  56. +230 −0 Synergy Editor TGC/Synergy Editor/NewProjectDialog.cpp
  57. +53 −0 Synergy Editor TGC/Synergy Editor/NewProjectDialog.h
  58. +142 −0 Synergy Editor TGC/Synergy Editor/OptionsDlg.cpp
  59. +48 −0 Synergy Editor TGC/Synergy Editor/OptionsDlg.h
  60. +300 −0 Synergy Editor TGC/Synergy Editor/OptionsPageDefaults.cpp
  61. +66 −0 Synergy Editor TGC/Synergy Editor/OptionsPageDefaults.h
  62. +271 −0 Synergy Editor TGC/Synergy Editor/OptionsPageEnvironment.cpp
  63. +66 −0 Synergy Editor TGC/Synergy Editor/OptionsPageEnvironment.h
  64. +272 −0 Synergy Editor TGC/Synergy Editor/OptionsPageFonts.cpp
  65. +43 −0 Synergy Editor TGC/Synergy Editor/OptionsPageFonts.h
  66. +77 −0 Synergy Editor TGC/Synergy Editor/OptionsPageHelp.cpp
  67. +30 −0 Synergy Editor TGC/Synergy Editor/OptionsPageHelp.h
  68. +114 −0 Synergy Editor TGC/Synergy Editor/OptionsPageSemantic.cpp
  69. +49 −0 Synergy Editor TGC/Synergy Editor/OptionsPageSemantic.h
  70. +149 −0 Synergy Editor TGC/Synergy Editor/OptionsPageStartup.cpp
  71. +34 −0 Synergy Editor TGC/Synergy Editor/OptionsPageStartup.h
  72. +254 −0 Synergy Editor TGC/Synergy Editor/OptionsPageText.cpp
  73. +79 −0 Synergy Editor TGC/Synergy Editor/OptionsPageText.h
  74. +140 −0 Synergy Editor TGC/Synergy Editor/OutlineParser.cpp
  75. +9 −0 Synergy Editor TGC/Synergy Editor/OutlineParser.h
  76. +322 −0 Synergy Editor TGC/Synergy Editor/OutputBar.cpp
  77. +63 −0 Synergy Editor TGC/Synergy Editor/OutputBar.h
  78. +237 −0 Synergy Editor TGC/Synergy Editor/ReadError.cpp
  79. +8 −0 Synergy Editor TGC/Synergy Editor/ReadError.h
  80. +341 −0 Synergy Editor TGC/Synergy Editor/ReadProject.cpp
  81. +19 −0 Synergy Editor TGC/Synergy Editor/ReadProject.h
  82. +803 −0 Synergy Editor TGC/Synergy Editor/SemanticParser.cpp
  83. +181 −0 Synergy Editor TGC/Synergy Editor/SemanticParser.h
  84. +97 −0 Synergy Editor TGC/Synergy Editor/SemanticParserManager.cpp
  85. +23 −0 Synergy Editor TGC/Synergy Editor/SemanticParserManager.h
  86. +418 −0 Synergy Editor TGC/Synergy Editor/Settings.cpp
  87. +110 −0 Synergy Editor TGC/Synergy Editor/Settings.h
  88. +183 −0 Synergy Editor TGC/Synergy Editor/SnippetWnd.cpp
  89. +36 −0 Synergy Editor TGC/Synergy Editor/SnippetWnd.h
  90. +10 −0 Synergy Editor TGC/Synergy Editor/SourceFile.cpp
  91. +11 −0 Synergy Editor TGC/Synergy Editor/SourceFile.h
  92. +451 −0 Synergy Editor TGC/Synergy Editor/Synergy Editor.cpp
  93. +55 −0 Synergy Editor TGC/Synergy Editor/Synergy Editor.h
  94. +11 −0 Synergy Editor TGC/Synergy Editor/Synergy Editor.icproj
  95. +7 −0 Synergy Editor TGC/Synergy Editor/Synergy Editor.icproj.insp.cfg
  96. +1,823 −0 Synergy Editor TGC/Synergy Editor/Synergy Editor.rc
  97. +1,155 −0 Synergy Editor TGC/Synergy Editor/Synergy Editor.vcproj
  98. +470 −0 Synergy Editor TGC/Synergy Editor/Synergy Editor.vcxproj
  99. +534 −0 Synergy Editor TGC/Synergy Editor/Synergy Editor.vcxproj.filters
  100. +35 −0 Synergy Editor TGC/Synergy Editor/Synergy Editor2.rc
  101. 0 Synergy Editor TGC/Synergy Editor/TestLee.cpp
  102. 0 Synergy Editor TGC/Synergy Editor/TestLee.h
  103. +19 −0 Synergy Editor TGC/Synergy Editor/TestLee.htm
  104. +460 −0 Synergy Editor TGC/Synergy Editor/ToDoWindow.cpp
  105. +62 −0 Synergy Editor TGC/Synergy Editor/ToDoWindow.h
  106. +548 −0 Synergy Editor TGC/Synergy Editor/UpdateFtpCore.cpp
  107. +22 −0 Synergy Editor TGC/Synergy Editor/UpdateFtpCore.h
  108. +25 −0 Synergy Editor TGC/Synergy Editor/UpdateGlobal.cpp
  109. +7 −0 Synergy Editor TGC/Synergy Editor/UpdateGlobal.h
  110. +307 −0 Synergy Editor TGC/Synergy Editor/UpdateWindow.cpp
  111. +82 −0 Synergy Editor TGC/Synergy Editor/UpdateWindow.h
  112. +648 −0 Synergy Editor TGC/Synergy Editor/Utilities.cpp
  113. +47 −0 Synergy Editor TGC/Synergy Editor/Utilities.h
  114. +352 −0 Synergy Editor TGC/Synergy Editor/Variables.cpp
  115. +77 −0 Synergy Editor TGC/Synergy Editor/Variables.h
  116. +987 −0 Synergy Editor TGC/Synergy Editor/View.cpp
  117. +146 −0 Synergy Editor TGC/Synergy Editor/View.h
  118. +129 −0 Synergy Editor TGC/Synergy Editor/WelcomeDialog.cpp
  119. +38 −0 Synergy Editor TGC/Synergy Editor/WelcomeDialog.h
  120. +281 −0 Synergy Editor TGC/Synergy Editor/WelcomePages.cpp
  121. +54 −0 Synergy Editor TGC/Synergy Editor/WelcomePages.h
  122. +653 −0 Synergy Editor TGC/Synergy Editor/WorkSpaceBar.cpp
  123. +80 −0 Synergy Editor TGC/Synergy Editor/WorkSpaceBar.h
  124. +450 −0 Synergy Editor TGC/Synergy Editor/WorkSpaceBar2.cpp
  125. +71 −0 Synergy Editor TGC/Synergy Editor/WorkSpaceBar2.h
  126. +207 −0 Synergy Editor TGC/Synergy Editor/WriteFiles.cpp
  127. +11 −0 Synergy Editor TGC/Synergy Editor/WriteFiles.h
  128. +381 −0 Synergy Editor TGC/Synergy Editor/WriteProject.cpp
  129. +8 −0 Synergy Editor TGC/Synergy Editor/WriteProject.h
  130. +579 −0 Synergy Editor TGC/Synergy Editor/getdxver.cpp
  131. BIN Synergy Editor TGC/Synergy Editor/res/Browser.bmp
  132. BIN Synergy Editor TGC/Synergy Editor/res/Cursor.bmp
  133. BIN Synergy Editor TGC/Synergy Editor/res/Edit.bmp
  134. BIN Synergy Editor TGC/Synergy Editor/res/Media.bmp
  135. BIN Synergy Editor TGC/Synergy Editor/res/Pyramid.bmp
  136. BIN Synergy Editor TGC/Synergy Editor/res/Solution.bmp
  137. BIN Synergy Editor TGC/Synergy Editor/res/SourceFile.bmp
  138. BIN Synergy Editor TGC/Synergy Editor/res/Synergy Editor.ico
  139. BIN Synergy Editor TGC/Synergy Editor/res/Synergy EditorDoc.ico
  140. +13 −0 Synergy Editor TGC/Synergy Editor/res/SynergyEditor.rc2
  141. BIN Synergy Editor TGC/Synergy Editor/res/Toolbar.bmp
  142. BIN Synergy Editor TGC/Synergy Editor/res/Toolbar256.bmp
  143. BIN Synergy Editor TGC/Synergy Editor/res/UserImages.bmp
  144. BIN Synergy Editor TGC/Synergy Editor/res/bitmap3.bmp
  145. BIN Synergy Editor TGC/Synergy Editor/res/bitmap4.bmp
  146. BIN Synergy Editor TGC/Synergy Editor/res/bmp00001.bmp
  147. BIN Synergy Editor TGC/Synergy Editor/res/bmp00002.bmp
  148. BIN Synergy Editor TGC/Synergy Editor/res/bmp00003.bmp
  149. BIN Synergy Editor TGC/Synergy Editor/res/bmp00004.bmp
  150. BIN Synergy Editor TGC/Synergy Editor/res/bmp00005.bmp
  151. BIN Synergy Editor TGC/Synergy Editor/res/bmp00006.bmp
  152. BIN Synergy Editor TGC/Synergy Editor/res/bmp00007.bmp
  153. BIN Synergy Editor TGC/Synergy Editor/res/bmp00008.bmp
  154. BIN Synergy Editor TGC/Synergy Editor/res/break.bmp
  155. BIN Synergy Editor TGC/Synergy Editor/res/classview.bmp
  156. BIN Synergy Editor TGC/Synergy Editor/res/classview_hc.bmp
  157. +127 −0 Synergy Editor TGC/Synergy Editor/res/defcurso.bin
  158. BIN Synergy Editor TGC/Synergy Editor/res/filevie24.bmp
  159. BIN Synergy Editor TGC/Synergy Editor/res/fileview.bmp
  160. BIN Synergy Editor TGC/Synergy Editor/res/icon1.ico
  161. BIN Synergy Editor TGC/Synergy Editor/res/idr_unti.ico
  162. +163 −0 Synergy Editor TGC/Synergy Editor/res/ini1.bin
  163. BIN Synergy Editor TGC/Synergy Editor/res/mainfram.bmp
  164. BIN Synergy Editor TGC/Synergy Editor/res/optionsimages.bmp
  165. BIN Synergy Editor TGC/Synergy Editor/res/properties_bar.bmp
  166. BIN Synergy Editor TGC/Synergy Editor/res/properties_bar_hc.bmp
  167. +1 −0 Synergy Editor TGC/Synergy Editor/res/serial1.bin
  168. BIN Synergy Editor TGC/Synergy Editor/res/toolbar1.bmp
  169. BIN Synergy Editor TGC/Synergy Editor/res/vssver2.scc
  170. BIN Synergy Editor TGC/Synergy Editor/res/workspace.bmp
  171. +16 −0 Synergy Editor TGC/Synergy Editor/res/xml1.bin
  172. +444 −0 Synergy Editor TGC/Synergy Editor/resource.h
  173. +7 −0 Synergy Editor TGC/Synergy Editor/stdafx.cpp
  174. +75 −0 Synergy Editor TGC/Synergy Editor/stdafx.h
  175. 0 Synergy Editor TGC/Synergy Editor/testweb.cpp
  176. 0 Synergy Editor TGC/Synergy Editor/testweb.h
  177. +19 −0 Synergy Editor TGC/Synergy Editor/testweb.htm
  178. +81 −0 Synergy Editor TGC/Synergy Editor/thread.h
  179. +1 −0 Synergy Editor TGC/readme.txt
@@ -0,0 +1,32 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Synergy Editor", "Synergy Editor\Synergy Editor.vcxproj", "{D2157F4F-E3E2-455D-9D10-71E9A8FB78D0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
ReleaseNETBOOK|Win32 = ReleaseNETBOOK|Win32
Remote|Win32 = Remote|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D2157F4F-E3E2-455D-9D10-71E9A8FB78D0}.Debug|Win32.ActiveCfg = Debug|Win32
{D2157F4F-E3E2-455D-9D10-71E9A8FB78D0}.Debug|Win32.Build.0 = Debug|Win32
{D2157F4F-E3E2-455D-9D10-71E9A8FB78D0}.Release|Win32.ActiveCfg = Release|Win32
{D2157F4F-E3E2-455D-9D10-71E9A8FB78D0}.Release|Win32.Build.0 = Release|Win32
{D2157F4F-E3E2-455D-9D10-71E9A8FB78D0}.ReleaseNETBOOK|Win32.ActiveCfg = ReleaseNETBOOK|Win32
{D2157F4F-E3E2-455D-9D10-71E9A8FB78D0}.ReleaseNETBOOK|Win32.Build.0 = ReleaseNETBOOK|Win32
{D2157F4F-E3E2-455D-9D10-71E9A8FB78D0}.Remote|Win32.ActiveCfg = Remote|Win32
{D2157F4F-E3E2-455D-9D10-71E9A8FB78D0}.Remote|Win32.Build.0 = Remote|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
CodeStyleEnforcer_RulesLocation =
CodeStyleEnforcer_Active = 0
EndGlobalSection
EndGlobal
@@ -0,0 +1,128 @@
// AdBanner.cpp : implementation file
//

#include "stdafx.h"
#include "AdBanner.h"
#include "HTTPComm.h"
#include "GameCreatorStore.h"
#include <atlimage.h>


// CAdBanner

IMPLEMENT_DYNAMIC(CAdBanner, CButton)

CAdBanner::CAdBanner()
{
m_bBitmapLoaded = false;
m_bLoading = false;
}

CAdBanner::~CAdBanner()
{
}


BEGIN_MESSAGE_MAP(CAdBanner, CButton)
ON_WM_PAINT()
ON_WM_ERASEBKGND()
END_MESSAGE_MAP()

unsigned CAdBanner::Run( )
{
m_bBitmapLoaded = false;
m_bLoading = true;

CString sPath = "TGCStore\\TEMP\\AdBanner.bmp";
HTTPComm server;

//HTTP call here
bool result = server.GetPreviewImage( "HTMLImages/AdBanner.bmp", sPath );
//if ( !result ) MessageBox( server.GetLastError( ), "TGC Store Error" );
if ( !result ) return 0;

//try and load the downloaded image
SetCurrentDirectory( theApp.m_szDirectory );
CImage image;
HRESULT hr = image.Load( sPath );
if ( FAILED(hr) ) return 0;

CWindowDC wndDC( this );
CDC dc;
dc.CreateCompatibleDC( &wndDC );

//copy the image to the local bitmap
m_bmpBanner.DeleteObject( );
m_bmpBanner.CreateBitmap( image.GetWidth(),image.GetHeight(), 1, 32, NULL );
CBitmap *oldBmp = dc.SelectObject( &m_bmpBanner );

::SetStretchBltMode( image.GetDC(), HALFTONE );
::SetBrushOrgEx( image.GetDC(), 0,0, NULL );
image.BitBlt( dc.GetSafeHdc( ), 0,0 );
dc.SelectObject( oldBmp );

image.ReleaseDC();
image.ReleaseDC();

//let the control draw the bitmap now
m_bLoading = false;
m_bBitmapLoaded = true;

Invalidate( );

return 0;
}



// CAdBanner message handlers

BOOL CAdBanner::OnEraseBkgnd( CDC *pDC )
{
return FALSE;
}

void CAdBanner::OnPaint()
{
CPaintDC dc( this );

CRect rectClient;
GetClientRect( &rectClient );

//CBrush brush; brush.CreateSolidBrush( GetSysColor( COLOR_3DFACE ) );
CPen pen; pen.CreatePen( PS_SOLID, 1, RGB(0,0,0) );
dc.SelectObject( &pen );
//dc.SelectObject( &brush );
dc.SelectStockObject( NULL_BRUSH );
dc.Rectangle( &rectClient );

if ( m_bBitmapLoaded )
{
//if the bitmap is loaded
CDC bmpDC;
bmpDC.CreateCompatibleDC( &dc );
bmpDC.SelectObject( &m_bmpBanner );

BITMAP details;
m_bmpBanner.GetBitmap( &details );

int iY = 0;
if ( rectClient.Height() > details.bmHeight ) iY = (rectClient.Height() - details.bmHeight) / 2;

dc.BitBlt( 0,iY, rectClient.Width(), rectClient.Height(), &bmpDC, 0,0, SRCCOPY );
}

if ( m_bLoading )
{
//optional loading screen
dc.SelectObject( GetFont( ) );
dc.SetBkMode( OPAQUE );
dc.SetBkColor( GetSysColor( COLOR_3DFACE ) );
dc.SetTextColor( RGB(0,0,0) );

//CString sText;
//GetWindowText( sText );
//dc.DrawText( GetLanguageData( _T("TGC Store"), _T("PleaseWait") ), -1, &rectClient, DT_CENTER | DT_SINGLELINE | DT_VCENTER );
//sText.ReleaseBuffer( );
}
}
@@ -0,0 +1,29 @@
#pragma once

#include "Thread.h"

// CAdBanner

class CAdBanner : public CButton, public Thread
{
DECLARE_DYNAMIC(CAdBanner)

public:
CAdBanner();
virtual ~CAdBanner();

void SetLoading( bool loading ) { m_bLoading = loading; Invalidate(); }

protected:
DECLARE_MESSAGE_MAP()
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd( CDC *pDC );

unsigned Run( );

CBitmap m_bmpBanner;
bool m_bBitmapLoaded;
bool m_bLoading;
};


@@ -0,0 +1,165 @@
// Includes
#include "stdafx.h"
#include "AdvertThread.h"
#include "Synergy Editor.h"
#include "Utilities.h"
#include "Settings.h"
#include "direct.h"
#include "io.h"
#include "httpcomm.h"

// Defines
#define _CRT_SECURE_NO_WARNINGS

// Globals
bool g_bUsingAdvertising = false;
bool g_bUsingAdvertisingLoaded = false;
LONGLONG g_lUsingAdvertisingTimeStamp = 0;

// this code is called by the thread (independent of the main code)
unsigned CAdvertThread::Run( )
{
// are we free or full version user
g_bUsingAdvertising = IsFreeVersion();

// end thread
return 0;
}
CAdvertThread::CAdvertThread()
{
}
CAdvertThread::~CAdvertThread()
{
}
bool CAdvertThread::IsCertificateFree ( LPSTR pCertificate )
{
// connection details (default is free)
LPSTR pServer = "www.darkbasic.com";
LPSTR pPage = "tgco/isfree.php";

// init connection
HTTP_Connect ( pServer );

// prepare data to post
LPSTR pPostData = new char [ 256 ];
strcpy ( pPostData, "c=12345678901234567890123456789012" );
strcpy ( pPostData, "c=" );
strcat ( pPostData, pCertificate );
DWORD dwPostDataSize = strlen (pPostData);

// prepare header
LPSTR pHeader = new char[256];
sprintf ( pHeader, "Content-Type: application/x-www-form-urlencoded\r\nContent-Length: %d\r\n", dwPostDataSize );
DWORD dwHeaderSize = -1L;

// issue request and get data back
LPSTR pData = HTTP_RequestData ( "POST", pPage, pHeader, dwHeaderSize, pPostData, dwPostDataSize );

// free usages
if ( pHeader )
{
delete pHeader;
pHeader=NULL;
}
if ( pPostData )
{
delete pPostData;
pPostData=NULL;
}

// free connection
HTTP_Disconnect();

// calculate result
bool bIsFree = true;
if ( pData )
{
if ( strcmp ( pData, "0" )==NULL ) bIsFree = false;
delete pData;
}

// return if free version
return bIsFree;
}
bool CAdvertThread::IsFreeVersion ( void )
{
// scan certificates folder for DBP certificate, then send it to server
// to see if we are using a free or paid-up version
bool bFree = true;

// find certificate folder and switch to it
char pOldDir [ _MAX_PATH ];
_getcwd ( pOldDir, _MAX_PATH );
CString pCertFolder = Settings::DBPLocation + L"Compiler\\certificates\\";
SetCurrentDirectory ( pCertFolder );

// find DBP certificate
_finddata_t filedata;
long hInternalFile = _findfirst("*.*", &filedata);
if(hInternalFile!=-1L)
{
int FileReturnValue = 0;
bool bContainsDBPString = false;
while ( FileReturnValue==0 && bFree==true )
{
if( !(filedata.attrib & _A_SUBDIR) )
{
char pFilename[256];
strcpy ( pFilename, filedata.name );
if ( pFilename )
{
if ( strlen(pFilename)==32 )
{
// found certificate file, read it to check if DBP certificate
HANDLE hFile = NULL;
DWORD dwBytesRead = 0;
hFile = CreateFileA ( pFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL );
if ( hFile != INVALID_HANDLE_VALUE )
{
DWORD dwFileSize = GetFileSize ( hFile, NULL );
LPSTR pFileData = new char[dwFileSize];
if ( pFileData )
{
ReadFile ( hFile, pFileData, dwFileSize, &dwBytesRead, NULL );
for ( DWORD n=0; n<dwFileSize; n++ )
{
if ( strnicmp ( pFileData + n, "Dark Basic Professional", 22 )==NULL )
{
// if it terminates
LPSTR pEndChar = pFileData + n + 23;
if ( *(pEndChar)==0 || *(pEndChar)==10 || *(pEndChar)==13 )
{
bContainsDBPString=true;
break;
}
}
}
delete pFileData;
if ( bContainsDBPString==true )
{
// found DBP certificate, is it a paid-up version?
if ( IsCertificateFree ( pFilename )==false )
{
// not free, so remove advertising
bFree = false;
}
}
}
CloseHandle ( hFile );
hFile = NULL;
}
}
}
}
FileReturnValue = _findnext(hInternalFile, &filedata);
}
_findclose(hInternalFile);
hInternalFile=NULL;
}

// restore folder
_chdir ( pOldDir );

// return result
return bFree;
}
@@ -0,0 +1,17 @@
#include "stdafx.h"
#include "thread.h"

#pragma once

class CAdvertThread : public Thread
{
public:
CAdvertThread();
virtual ~CAdvertThread();

public:
unsigned Run( );
bool IsCertificateFree ( LPSTR pCertificate );
bool IsFreeVersion();

};
Oops, something went wrong.

0 comments on commit acb03d0

Please sign in to comment.
You can’t perform that action at this time.