Old fashion design for PC-104
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

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: SetupLGSDoc.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of SetupLGSDoc.cpp
  13. //----------------------------------------------------------------------------
  14. // SetupLGSDoc.cpp : implementation of the CSetupLGSDoc class
  15. //
  16. #include "stdafx.h"
  17. #include "SetupLGS.h"
  18. #include "..\DLIB\ObjectFactory.h"
  19. #include "..\..\LgLib\MFC\LgBitCodeFile.h"
  20. #include "SetupLGSDoc.h"
  21. #include "ProtectionDlg.h"
  22. #ifdef _DEBUG
  23. #define new DEBUG_NEW
  24. #undef THIS_FILE
  25. static char THIS_FILE[] = __FILE__;
  26. #endif
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CSetupLGSDoc
  29. IMPLEMENT_DYNCREATE(CSetupLGSDoc, CDocument)
  30. BEGIN_MESSAGE_MAP(CSetupLGSDoc, CDocument)
  31. //{{AFX_MSG_MAP(CSetupLGSDoc)
  32. ON_COMMAND(IDC_PROTECTION_STRING, OnProtectionString)
  33. //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CSetupLGSDoc construction/destruction
  37. CSetupLGSDoc::CSetupLGSDoc()
  38. {
  39. }
  40. CSetupLGSDoc::~CSetupLGSDoc()
  41. {
  42. }
  43. BOOL CSetupLGSDoc::OnNewDocument()
  44. {
  45. if (!CDocument::OnNewDocument())
  46. return FALSE;
  47. // TODO: add reinitialization code here
  48. // (SDI documents will reuse this document)
  49. return TRUE;
  50. }
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CSetupLGSDoc serialization
  53. void CSetupLGSDoc::Serialize(CArchive& ar)
  54. {
  55. m_OF.Serialize( ar );
  56. }
  57. /////////////////////////////////////////////////////////////////////////////
  58. // CSetupLGSDoc diagnostics
  59. #ifdef _DEBUG
  60. void CSetupLGSDoc::AssertValid() const
  61. {
  62. CDocument::AssertValid();
  63. }
  64. void CSetupLGSDoc::Dump(CDumpContext& dc) const
  65. {
  66. CDocument::Dump(dc);
  67. }
  68. #endif //_DEBUG
  69. void CSetupLGSDoc::OnProtectionString()
  70. {
  71. #ifndef SETUP_DEMO_VERSION
  72. CString str;
  73. if( m_OF.GetProtectedString( str ) )
  74. {
  75. CProtectionDlg dlg;
  76. dlg.SetProtectionString( str );
  77. if( dlg.DoModal() == IDOK )
  78. {
  79. str = dlg.GetProtectionString();
  80. m_OF.SetProtectedString( str );
  81. }
  82. }
  83. #endif
  84. }
  85. CFile* CSetupLGSDoc::GetFile( LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError )
  86. {
  87. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CSetupLGSDoc::GetFile", "File name <%s>", lpszFileName );
  88. // create file object
  89. CLgBitCodeFile *pFile = new CLgBitCodeFile(9);
  90. if( !pFile )
  91. return FALSE;
  92. // open file
  93. if( !pFile->Open( lpszFileName, nOpenFlags, pError ) )
  94. {
  95. delete pFile;
  96. return FALSE;
  97. }
  98. return pFile;
  99. }
  100. void CSetupLGSDoc::ReleaseFile( CFile* pFile, BOOL bAbort )
  101. {
  102. if( !pFile )
  103. {
  104. LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, "CSetupLGSDoc::ReleaseFile", "pFile == NULL" );
  105. return;
  106. }
  107. if( bAbort )
  108. pFile->Abort();
  109. else
  110. pFile->Close();
  111. delete (CLgBitCodeFile*)pFile;
  112. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CSetupLGSDoc::ReleaseFile" );
  113. }