00001 // Filename: patchfile.I 00002 // Created by: darren, mike (09Jan97) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 //#include "config_downloader.h" 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Function: Patchfile::get_progress 00023 // Access: Published 00024 // Description: 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE float Patchfile:: 00027 get_progress(void) const { 00028 if (false == _initiated) { 00029 express_cat.warning() 00030 << "Patchfile::get_progress() - Patch has not been initiated" << endl; 00031 return 0.0f; 00032 } 00033 nassertr(_result_file_length > 0, 0.0f); 00034 return ((float)_total_bytes_processed / (float)_result_file_length); 00035 } 00036 00037 //////////////////////////////////////////////////////////////////// 00038 // Function: Patchfile::set_footprint_length 00039 // Access: Published 00040 // Description: 00041 //////////////////////////////////////////////////////////////////// 00042 INLINE void Patchfile:: 00043 set_footprint_length(int length) { 00044 nassertv(_footprint_length > 0); 00045 _footprint_length = length; 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: Patchfile::get_footprint_length 00050 // Access: Published 00051 // Description: 00052 //////////////////////////////////////////////////////////////////// 00053 INLINE int Patchfile:: 00054 get_footprint_length() { 00055 return _footprint_length; 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: Patchfile::reset_footprint_length 00060 // Access: Published 00061 // Description: 00062 //////////////////////////////////////////////////////////////////// 00063 INLINE void Patchfile:: 00064 reset_footprint_length() { 00065 _footprint_length = _DEFAULT_FOOTPRINT_LENGTH; 00066 } 00067 00068 //////////////////////////////////////////////////////////////////// 00069 // Function: Patchfile::has_source_hash 00070 // Access: Published 00071 // Description: Returns true if the MD5 hash for the source file is 00072 // known. (Some early versions of the patch file did 00073 // not store this information.) 00074 //////////////////////////////////////////////////////////////////// 00075 INLINE bool Patchfile:: 00076 has_source_hash() const { 00077 return (_version_number >= 1); 00078 } 00079 00080 //////////////////////////////////////////////////////////////////// 00081 // Function: Patchfile::get_source_hash 00082 // Access: Published 00083 // Description: Returns the MD5 hash for the source file. 00084 //////////////////////////////////////////////////////////////////// 00085 INLINE const HashVal &Patchfile:: 00086 get_source_hash() const { 00087 nassertr(has_source_hash(), _MD5_ofSource); 00088 return _MD5_ofSource; 00089 } 00090 00091 //////////////////////////////////////////////////////////////////// 00092 // Function: Patchfile::get_result_hash 00093 // Access: Published 00094 // Description: Returns the MD5 hash for the file after the patch has 00095 // been applied. 00096 //////////////////////////////////////////////////////////////////// 00097 INLINE const HashVal &Patchfile:: 00098 get_result_hash() const { 00099 return _MD5_ofResult; 00100 }