You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
3.1 KiB
144 lines
3.1 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: SetupLGSDoc.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of SetupLGSDoc.cpp
|
|
//----------------------------------------------------------------------------
|
|
// SetupLGSDoc.cpp : implementation of the CSetupLGSDoc class
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "SetupLGS.h"
|
|
|
|
#include "..\DLIB\ObjectFactory.h"
|
|
#include "..\..\LgLib\MFC\LgBitCodeFile.h"
|
|
|
|
#include "SetupLGSDoc.h"
|
|
#include "ProtectionDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CSetupLGSDoc
|
|
|
|
IMPLEMENT_DYNCREATE(CSetupLGSDoc, CDocument)
|
|
|
|
BEGIN_MESSAGE_MAP(CSetupLGSDoc, CDocument)
|
|
//{{AFX_MSG_MAP(CSetupLGSDoc)
|
|
ON_COMMAND(IDC_PROTECTION_STRING, OnProtectionString)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CSetupLGSDoc construction/destruction
|
|
|
|
CSetupLGSDoc::CSetupLGSDoc()
|
|
{
|
|
}
|
|
|
|
CSetupLGSDoc::~CSetupLGSDoc()
|
|
{
|
|
}
|
|
|
|
BOOL CSetupLGSDoc::OnNewDocument()
|
|
{
|
|
if (!CDocument::OnNewDocument())
|
|
return FALSE;
|
|
|
|
// TODO: add reinitialization code here
|
|
// (SDI documents will reuse this document)
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CSetupLGSDoc serialization
|
|
|
|
void CSetupLGSDoc::Serialize(CArchive& ar)
|
|
{
|
|
m_OF.Serialize( ar );
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CSetupLGSDoc diagnostics
|
|
|
|
#ifdef _DEBUG
|
|
void CSetupLGSDoc::AssertValid() const
|
|
{
|
|
CDocument::AssertValid();
|
|
}
|
|
|
|
void CSetupLGSDoc::Dump(CDumpContext& dc) const
|
|
{
|
|
CDocument::Dump(dc);
|
|
}
|
|
#endif //_DEBUG
|
|
|
|
|
|
void CSetupLGSDoc::OnProtectionString()
|
|
{
|
|
#ifndef SETUP_DEMO_VERSION
|
|
CString str;
|
|
if( m_OF.GetProtectedString( str ) )
|
|
{
|
|
CProtectionDlg dlg;
|
|
dlg.SetProtectionString( str );
|
|
if( dlg.DoModal() == IDOK )
|
|
{
|
|
str = dlg.GetProtectionString();
|
|
m_OF.SetProtectedString( str );
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
|
|
CFile* CSetupLGSDoc::GetFile( LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError )
|
|
{
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CSetupLGSDoc::GetFile", "File name <%s>", lpszFileName );
|
|
|
|
// create file object
|
|
CLgBitCodeFile *pFile = new CLgBitCodeFile(9);
|
|
if( !pFile )
|
|
return FALSE;
|
|
|
|
// open file
|
|
if( !pFile->Open( lpszFileName, nOpenFlags, pError ) )
|
|
{
|
|
delete pFile;
|
|
return FALSE;
|
|
}
|
|
|
|
return pFile;
|
|
}
|
|
|
|
void CSetupLGSDoc::ReleaseFile( CFile* pFile, BOOL bAbort )
|
|
{
|
|
if( !pFile )
|
|
{
|
|
LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CSetupLGSDoc::ReleaseFile", "pFile == NULL" );
|
|
return;
|
|
}
|
|
|
|
if( bAbort )
|
|
pFile->Abort();
|
|
else
|
|
pFile->Close();
|
|
|
|
delete (CLgBitCodeFile*)pFile;
|
|
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CSetupLGSDoc::ReleaseFile" );
|
|
}
|
|
|