VSSClass.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : LevelEdit *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/LevelEdit/VSSClass.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 1/29/02 3:11p $*
  29. * *
  30. * $Revision:: 9 $*
  31. * *
  32. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  33. #if defined(_MSC_VER)
  34. #pragma once
  35. #endif
  36. #ifndef __VSSCLASS_H
  37. #define __VSSCLASS_H
  38. #include "wtypes.h"
  39. #include "oaidl.h"
  40. #include "ocidl.h"
  41. #include "vss.h"
  42. #include "utils.h"
  43. #include "assetdatabase.h"
  44. ///////////////////////////////////////////////////////////////////////////
  45. //
  46. // VSSClass
  47. //
  48. // Class definition used to abstract the Visual Source Safe COM interface.
  49. //
  50. ///////////////////////////////////////////////////////////////////////////
  51. class VSSClass : public AssetDatabaseClass
  52. {
  53. public:
  54. //////////////////////////////////////////////////////////
  55. //
  56. // Public constructors/destructors
  57. //
  58. VSSClass (void)
  59. : m_pIVSSDatabase (NULL),
  60. m_bReadOnly (TRUE) { ::CoInitialize (NULL); }
  61. virtual ~VSSClass (void) { COM_RELEASE (m_pIVSSDatabase); ::CoUninitialize (); }
  62. //////////////////////////////////////////////////////////
  63. //
  64. // Public Methods
  65. //
  66. //
  67. // Database methods
  68. //
  69. bool Open_Database (LPCTSTR ini_filename, LPCTSTR username = NULL, LPCTSTR password = NULL);
  70. //
  71. // File manipulation methods
  72. //
  73. bool Add_File (LPCTSTR local_filename, LPCTSTR comment = NULL);
  74. bool Check_In (LPCTSTR local_filename, LPCTSTR comment = NULL);
  75. bool Check_Out (LPCTSTR local_filename, bool get_locally = true);
  76. bool Undo_Check_Out (LPCTSTR local_filename);
  77. bool Get (LPCTSTR local_filename);
  78. bool Get (LPCTSTR local_filename, IVSSItem *pitem);
  79. void Get_Recursive (LPCTSTR local_path, IVSSItem *pparent);
  80. bool Get_Subproject (LPCTSTR local_filename);
  81. bool Destroy (LPCTSTR local_filename);
  82. FileClass * Get_File (LPCTSTR local_filename);
  83. //
  84. // Extended methods which provide UI
  85. //
  86. bool Check_Out_Ex (LPCTSTR local_filename, HWND parent_wnd);
  87. bool Check_In_Ex (LPCTSTR local_filename, HWND parent_wnd);
  88. //
  89. // Retry methods
  90. //
  91. bool Retry_Check_Out (LPCTSTR local_filename, int iattempts = 1, int idelay = 250);
  92. bool Retry_Check_In (LPCTSTR local_filename, int iattempts = 1, int idelay = 250);
  93. //
  94. // Folder (subproject) methods
  95. //
  96. bool Build_Tree (LPCTSTR local_filename);
  97. //
  98. // File information methods
  99. //
  100. VSSFileStatus Get_File_Status (LPCTSTR local_filename, LPTSTR checked_out_username = NULL, DWORD buffer_size = 0, IVSSItem *item_to_use = NULL);
  101. FILE_STATUS Get_File_Status (LPCTSTR local_filename, StringClass *checked_out_user_name);
  102. long Get_File_Version (LPCTSTR local_filename);
  103. bool Is_File_Different (LPCTSTR local_filename);
  104. bool Does_File_Exist (LPCTSTR local_filename);
  105. bool Get_File_Date (IVSSItem *pitem, SYSTEMTIME &system_time);
  106. VSSItemType Get_Type (LPCTSTR local_filename);
  107. //
  108. // User information
  109. //
  110. BOOL Is_Read_Only (void) const { return m_bReadOnly; }
  111. protected:
  112. //////////////////////////////////////////////////////////
  113. //
  114. // Protected methods
  115. //
  116. void Get_VSS_Interface (void);
  117. IVSSItem * Get_VSS_Item_From_Local_Path (LPCTSTR local_filename);
  118. IVSSItem * Get_VSS_Item (LPCTSTR vss_path);
  119. LPCTSTR Get_Error_Description (HRESULT hresult);
  120. private:
  121. //////////////////////////////////////////////////////////
  122. //
  123. // Private member data
  124. //
  125. IVSSDatabase * m_pIVSSDatabase;
  126. BOOL m_bReadOnly;
  127. };
  128. #endif //__VSSCLASS_H