mixfiledatabase.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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/mixfiledatabase.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 3/26/02 1:33p $*
  29. * *
  30. * $Revision:: 3 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __MIXFILEDATABASE_H
  39. #define __MIXFILEDATABASE_H
  40. #include "assetdatabase.h"
  41. #include "wwstring.h"
  42. #include "ffactory.h"
  43. #include "ffactorylist.h"
  44. //////////////////////////////////////////////////////////////////////
  45. // Forward declarations
  46. //////////////////////////////////////////////////////////////////////
  47. //////////////////////////////////////////////////////////////////////
  48. //
  49. // MixFileDatabaseClass
  50. //
  51. //////////////////////////////////////////////////////////////////////
  52. class MixFileDatabaseClass : public AssetDatabaseClass
  53. {
  54. public:
  55. ///////////////////////////////////////////////////////////////////
  56. // Public constructors/destructors
  57. ///////////////////////////////////////////////////////////////////
  58. MixFileDatabaseClass (void);
  59. virtual ~MixFileDatabaseClass (void);
  60. ///////////////////////////////////////////////////////////////////
  61. // Public methods
  62. ///////////////////////////////////////////////////////////////////
  63. //
  64. // Database methods
  65. //
  66. bool Open_Database (LPCTSTR ini_filename, LPCTSTR username = NULL, LPCTSTR password = NULL);
  67. //
  68. // File manipulation methods
  69. //
  70. bool Add_File (LPCTSTR local_filename, LPCTSTR comment = NULL) { return true; }
  71. bool Check_In (LPCTSTR local_filename, LPCTSTR comment = NULL) { return true; }
  72. bool Check_Out (LPCTSTR local_filename, bool get_locally = true);
  73. bool Undo_Check_Out (LPCTSTR local_filename) { return true; }
  74. bool Get (LPCTSTR local_filename);
  75. bool Get_Subproject (LPCTSTR local_filename) { return true; }
  76. bool Get_All (LPCTSTR dest_path, LPCTSTR search_mask);
  77. FileClass * Get_File (LPCTSTR local_filename);
  78. void Find_Files (DynamicVectorClass<StringClass> &file_list, LPCTSTR search_mask);
  79. //
  80. // Extended methods which provide UI
  81. //
  82. bool Check_Out_Ex (LPCTSTR local_filename, HWND parent_wnd) { return true; }
  83. bool Check_In_Ex (LPCTSTR local_filename, HWND parent_wnd) { return true; }
  84. //
  85. // Retry methods
  86. //
  87. bool Retry_Check_Out (LPCTSTR local_filename, int attempts = 1, int delay = 250) { return true; }
  88. bool Retry_Check_In (LPCTSTR local_filename, int attempts = 1, int delay = 250) { return true; }
  89. //
  90. // File information methods
  91. //
  92. FILE_STATUS Get_File_Status (LPCTSTR local_filename, StringClass *checked_out_user_name = NULL) { return CHECKED_OUT_TO_ME; }
  93. bool Is_File_Different (LPCTSTR local_filename) { return (Does_File_Exist (local_filename) == false); }
  94. bool Does_File_Exist (LPCTSTR local_filename);
  95. //
  96. // User information
  97. //
  98. BOOL Is_Read_Only (void) const { return FALSE; }
  99. //
  100. // Misc information
  101. //
  102. const char * Get_Mix_File_Path (void) const { return MixFilePath; }
  103. //
  104. // Static methods
  105. //
  106. static MixFileDatabaseClass * Get_Instance (void) { return _TheInstance; }
  107. protected:
  108. ///////////////////////////////////////////////////////////////////
  109. // Protected methods
  110. ///////////////////////////////////////////////////////////////////
  111. bool Copy_File (FileClass *file, LPCTSTR local_filename);
  112. void Create_Directory_Structure (LPCTSTR path);
  113. bool Internal_Does_File_Exist (LPCSTR filename);
  114. bool Internal_Get (LPCSTR filename, LPCSTR local_path);
  115. bool Is_Texture (LPCSTR filename);
  116. void Swap_Texture_Extension (StringClass &filename);
  117. void Get_Filename (LPCTSTR path, StringClass &filename);
  118. ///////////////////////////////////////////////////////////////////
  119. // Protected member data
  120. ///////////////////////////////////////////////////////////////////
  121. StringClass ModName;
  122. StringClass ModAssetPath;
  123. StringClass MixFilePath;
  124. FileFactoryListClass MainFileFactory;
  125. SimpleFileFactoryClass RenegadeDataFileFactory;
  126. static MixFileDatabaseClass * _TheInstance;
  127. };
  128. #endif //__MIXFILEDATABASE_H