File updating method and device, electronic equipment and computer readable storage medium
By comparing the identifiers and record information of game resource files, only the changed and newly added files are updated, which solves the problem of resource waste in game resource updates and improves update efficiency.
Patent Information
- Application Number
- CN202211680296.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-26
- Publication Date
- 2026-07-10
- Estimated Expiration
- 2042-12-26
AI Technical Summary
When updating game resources, existing technologies suffer from wasted resource downloads because the latest version of the game's resource package only requires updating a portion of the resources, while existing methods download the entire resource package, resulting in wasted resources.
By obtaining the latest version of the target resource file and the file identifier of the current version, comparing them, deleting resource sub-file records that do not need to be updated, adding necessary resource sub-files, and updating resource sub-files with different content, only updating the changed and newly added files.
The speed of confirming changed files has been improved, avoiding the waste of downloading resources and optimizing the game resource update process.
Smart Images

Figure CN116271848B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of document update technology, specifically to a document update method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] The rise of the internet and the continuous development and evolution of hardware and software technologies have spurred the emergence of smart devices and software. Simultaneously, a large number of games of various themes have sprung up to meet user needs. Currently, game performance is generally improved through resource updates, such as enhancing the display quality of game graphics to make them more refined.
[0003] In existing technologies, game resource updates are achieved by downloading the latest version of the game's resource package in real-time within the game and then updating based on this latest version. However, since the latest version of a game's resource package typically only contains a portion of the updated game resources, downloading the entire resource package would consume download resources already present in the game, resulting in wasted download resources during the update process. Summary of the Invention
[0004] This application provides a file update method, apparatus, electronic device, and computer-readable storage medium, which can avoid wasting download resources when updating game resources.
[0005] In a first aspect, embodiments of this application provide a file updating method, the method comprising:
[0006] Obtain the file identifiers of each first resource sub-file in the latest version resource file package of the target resource file;
[0007] Obtain the file record information corresponding to the current version resource file package of the above target resource file. The file record information includes the sub-file record information of each second resource sub-file in the current version resource file package. The sub-file record information includes the file identifier.
[0008] Based on the file identifiers of the first resource sub-file and the second resource sub-file, a file identifier comparison is performed;
[0009] If the file identifier of the second resource sub-file contains a first file identifier that is not present in the first resource sub-file, then the sub-file record information of the second resource sub-file to which the first file identifier belongs is deleted from the file record information to update the file record information;
[0010] If the file identifier of the first resource sub-file contains a second file identifier that the second resource sub-file does not have, then the first resource sub-file to which the second file identifier belongs will be updated in the current version resource file package, and the file record information will be updated.
[0011] If the contents of the first resource sub-file and the second resource sub-file with the same file identifier are different, then the first resource sub-file with different contents will be updated to the current version of the resource file package, and the file record information will be updated.
[0012] Secondly, embodiments of this application also provide a file updating device, the device comprising:
[0013] The identifier acquisition module is used to obtain the file identifiers of each first resource sub-file in the latest version resource file package of the target resource file;
[0014] The information acquisition module is used to acquire the file record information corresponding to the current version of the resource file package of the target resource file. The file record information includes the sub-file record information of each second resource sub-file in the current version of the resource file package. The sub-file record information includes the file identifier.
[0015] The identifier comparison module is used to compare file identifiers based on the file identifiers of the first resource sub-file and the second resource sub-file.
[0016] The information deletion module is used to delete the sub-file record information of the second resource sub-file to which the first resource sub-file belongs from the file record information if the file identifier of the second resource sub-file contains a first file identifier that is not present in the first resource sub-file, so as to update the file record information.
[0017] The first file update module is used to update the first resource sub-file to which the second file identifier belongs to the current version of the resource file package and update the file record information if the file identifier of the first resource sub-file contains a second file identifier that the second resource sub-file does not have.
[0018] The second file update module is used to update the first resource sub-file with different file content to the current version of the resource file package if the file content of the first resource sub-file with the same file identifier and the second resource sub-file are different, and to update the file record information.
[0019] Thirdly, embodiments of this application also provide an electronic device, including a memory storing multiple instructions; the processor loads instructions from the memory to execute any of the file update methods provided in embodiments of this application.
[0020] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute any of the file update methods provided in embodiments of this application.
[0021] In this embodiment, the file identifiers of each first resource sub-file in the latest version resource file package of the target resource file are obtained. Then, the file record information corresponding to the current version resource file package of the target resource file is obtained. The file record information includes the sub-file record information of each second resource sub-file in the current version resource file package, and the sub-file record information includes the file identifier. This file record information records various information about the files in the current version resource file. Based on the file identifiers of the first and second resource sub-files, a file identifier comparison is performed, thereby conveniently determining which files in the latest version resource file package have been changed, improving the speed of determining changed files. If the file identifier of the second resource sub-file contains a first file identifier that is not present in the first resource sub-file, the sub-file record information of the second resource sub-file to which the first file identifier belongs is deleted from the file record information to update the file record information. Therefore, only the sub-file record information corresponding to the deleted file needs to be deleted, achieving the updating of deleted files. If the file identifier of the first resource sub-file contains a second file identifier that the second resource sub-file does not have, then the first resource sub-file to which the second file identifier belongs is updated in the current version resource file package, and the file record information is updated. This allows for the identification of newly added files based on the file identifier, ensuring that only newly added files are updated. If the content of the first and second resource sub-files with the same file identifier differs, then the first resource sub-file with the different content is updated in the current version resource file package, and the file record information is updated. This allows for the identification of modified files based on the file identifier, ensuring that only modified files are updated. Therefore, when updating game resources, there is no need to expend download resources to download existing game resources, avoiding waste of download resources during game resource updates. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram of a file update scenario provided in an embodiment of this application;
[0024] Figure 2 This is a schematic flowchart of one embodiment of the file update method provided in this application;
[0025] Figure 3 This is a schematic diagram of the structure of the file record information provided in the embodiments of this application;
[0026] Figure 4 This is a schematic diagram of the structure of the file update device provided in the embodiments of this application;
[0027] Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0029] Before providing a detailed explanation of the embodiments of this application, some terms involved in the embodiments of this application will be explained.
[0030] In the description of the embodiments of this application, the terms "first," "second," etc., may be used herein to describe various concepts, but unless specifically stated otherwise, these concepts are not limited by these terms. These terms are used only to distinguish one concept from another. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.
[0031] This application provides a file update method, apparatus, electronic device, and computer-readable storage medium. Specifically, the file update method of this application can be executed by an electronic device, which can be a terminal or a server. The terminal can be a smartphone, tablet, laptop, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. The terminal can also include a client, which can be a game application client, a browser client carrying a game program, or an instant messaging client. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0032] For example, such as Figure 1 As shown, the electronic device is illustrated using terminal 10 as an example. Terminal 10 can obtain the file identifiers of each first resource sub-file in the latest version resource file package of the target resource file; obtain the file record information corresponding to the current version resource file package of the target resource file, the file record information including the sub-file record information of each second resource sub-file in the current version resource file package, the sub-file record information including the file identifier; compare the file identifiers based on the file identifiers of the first resource sub-files and the file identifiers of the second resource sub-files; if the file identifiers of the second resource sub-files contain a first file identifier that the first resource sub-file does not contain, then delete the sub-file record information of the second resource sub-file to which the first file identifier belongs from the file record information to update the file record information; if the file identifiers of the first resource sub-files contain a second file identifier that the second resource sub-file does not contain, then update the first resource sub-file to which the second file identifier belongs to the current version resource file package, and update the file record information; if the file content of the first resource sub-file and the second resource sub-file with the same file identifier is different, then update the first resource sub-file with the different file content to the current version resource file package, and update the file record information.
[0033] To address the aforementioned issues, this application provides a file update method, apparatus, electronic device, and computer-readable storage medium, which can avoid wasting download resources when updating game resources.
[0034] The following is a detailed description in conjunction with the accompanying drawings. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown in the drawings.
[0035] In this embodiment, a terminal is used as an example for illustration. This embodiment provides a file update method, such as... Figure 2 As shown, the specific process of updating this file can be as follows:
[0036] 201. Obtain the file identifiers of each first resource sub-file in the latest version of the target resource file's resource file package.
[0037] The aforementioned target resource file is used to indicate the resource files in the game that can be updated. Correspondingly, the latest version resource file package of the target resource file stores the various resource files with the latest version, that is, the resource files that the game needs to update when it needs to update game resources. The resource files in the latest version resource file package are called the first resource sub-files.
[0038] It should be noted that the first resource sub-files of the latest version in the latest version resource file package of the target resource file will not all change compared to the same resource sub-file in the current version resource file package of the target resource file currently used by the game. That is, the file version of a certain first resource sub-file in the latest version resource file package is the same as the file version of the same resource sub-file in the current version resource file package. Both are the latest version resource sub-files, and their file contents are the same.
[0039] Therefore, it is necessary to compare each first resource sub-file in the latest version of the target resource file package with each resource sub-file in the current version of the target resource file package to determine the first resource sub-files that have been changed in the latest version of the resource file package, so that file updates are performed only on the first resource sub-files that have been changed.
[0040] In this regard, it is necessary to clarify which resource sub-file in the latest version of the resource file package is the same as the first resource sub-file in the current version of the resource file package. That is, the first resource sub-file in the latest version of the resource file package should be compared with which resource sub-file in the current version of the resource file package.
[0041] Therefore, a file identifier is introduced in this embodiment. This file identifier is used to identify the file. That is, the unique resource sub-file corresponding to the file identifier can be determined from the resource file package through the file identifier. The file identifier includes, but is not limited to, the file name of the resource sub-file, the file number of the resource sub-file, or the original file path of the resource sub-file. The specific identifier can be determined based on the requirements and is not limited here.
[0042] The original file path of the aforementioned resource sub-file is the path of the development resource sub-file. For example, if the resource sub-file is set as texture A, then the original file path of texture A is the path where texture A is designed. When relevant staff continue to modify or change texture A, they will find texture A in the path where texture A is designed and continue to modify and design texture A. After the modification and design are completed, the modified texture A is saved in the path where texture A is designed. Therefore, texture A in different versions of resource file packages can be found based on the original file path of texture A.
[0043] Accordingly, the file identifier of the first resource sub-file is used to identify the first resource sub-file.
[0044] Among them, the file identifiers of the aforementioned first resource sub-files can be combined to generate record information, and then further judgments can be made.
[0045] 202. Obtain the file record information corresponding to the current version of the target resource file package. The file record information includes the sub-file record information of each second resource sub-file in the current version of the resource file package. The sub-file record information includes the file identifier.
[0046] Among them, the current version resource file package of the aforementioned target resource file is the resource file package of the target resource file currently used by the game. By comparing the first resource sub-file in the latest version resource file package with the resource sub-file in the current version resource file package, the terminal can determine which first resource sub-files in the latest version resource file package have changed.
[0047] The second resource sub-file is a resource file stored in the current version resource file package that can be used normally by the game, and it is also a resource file that is compared with the first resource sub-file in the latest version resource file package.
[0048] To quickly identify which first resource subfiles in the latest version of the resource package have changed when updating target resource files, this embodiment introduces file record information. This file record information records the subfile information of each second resource subfile in the current version of the resource package, i.e., the relevant information of the second resource subfiles. Therefore, during comparison, it is unnecessary to sequentially query which second resource subfiles exist in the current version of the resource package and read their relevant information. Simply by obtaining the file record information corresponding to the current version of the resource package, the file information of the relevant files to be compared with each first resource subfile in the latest version of the resource package can be obtained. Furthermore, this file record information can also be used to query the relevant information of the desired second resource subfile when the game uses a specific second resource subfile.
[0049] It is understandable that, in order to clarify which second resource sub-file in the current version of the resource file package should be compared with the first resource sub-file in the latest version of the resource file package, this embodiment uses file identifiers to associate the first resource sub-file in the latest version of the resource file package with the currently usable second resource sub-file in the current version of the resource file package. That is, in this embodiment, the file record information of each second resource sub-file in the current version of the resource file package must include file identifiers.
[0050] The sub-file record information mentioned above also includes at least one of the following: file memory, file content identifier, or file storage location. Specifically, the file memory indicates the memory size occupied by the second resource sub-file within the current version of the resource file package, i.e., the length of the sub-section occupied by the second resource sub-file; the file content identifier can be an identifier generated based on the file content of the resource file, and this identifier is unique, meaning that the file content identifier only represents the file content on which it was generated, for example, an identifier generated by the MD5 message digest algorithm; the file storage location indicates the storage location of the second resource sub-file within the current version of the resource file package.
[0051] Understandably, in order to improve the efficiency of comparing the first resource sub-file in the latest version of the resource file package with the same second resource sub-file in the current version of the resource file package, a file content identifier is introduced. This eliminates the need to compare the files sequentially based on their contents, and instead allows us to determine whether the first resource sub-file is consistent with the same second resource sub-file simply by checking whether the file content identifiers are the same.
[0052] In some embodiments, as people's demands for game performance increase, the number of game resource files in the game increases, and the memory of game resource files also increases. Therefore, in order to improve the reading speed when game resources are read, a storage file is introduced in this embodiment. That is, at least one storage file is included in the current version resource file package. This storage file is used to store the aforementioned second resource sub-file, thereby enabling some discrete resource files to be stored in one file and read.
[0053] Accordingly, when the current version resource file package can also store the storage file of the second resource sub-file, the file record information corresponding to the current version resource file package should include the information corresponding to the storage file, that is, the information corresponding to the storage file is recorded at a certain position in the file record information corresponding to the current version resource file package.
[0054] Accordingly, if the second resource sub-file is stored in a storage file within the current version of the resource file package, then the file storage location in the sub-file record information of the second resource sub-file may include the file number of the storage file in which the second resource sub-file is stored, as well as the file position of the second resource sub-file within that storage file. Specifically, if the sub-file record information contains file content, then the file position of the second resource sub-file within its storage file may include the file storage start position; conversely, if the sub-file record information does not contain file content, then the file position of the second resource sub-file within its storage file may include both the file storage start position and the file storage end position.
[0055] In some embodiments, in order to determine which storage file the resource sub-files to be operated on are located in during operation, the file record information also includes at least one file number of the storage file.
[0056] In some embodiments, since the storage file can store second resource sub-files, in order to intuitively view the file record information corresponding to the current version of the resource file package, and to more conveniently read or modify the file record information, the terminal can associate the sub-file record information of at least one of the aforementioned second resource sub-files in the storage file with the information of the storage file. For example, in the file record information, the sub-file record information of at least one of the aforementioned second resource sub-files in the storage file is placed after the information of the storage file, or the sub-file record information of at least one of the aforementioned second resource sub-files in the storage file is nested with the information of the storage file, etc. The specific settings can be configured according to the requirements and are not limited here.
[0057] Specifically, the aforementioned storage file can be stored in the form of information segments, that is, the aforementioned file record information also includes at least one file record information segment corresponding to the aforementioned storage file, the aforementioned file record information segment includes at least one sub-file record information segment of the aforementioned second resource sub-file located in the aforementioned storage file, and the aforementioned sub-file record information segment records the sub-file record information of the aforementioned second resource sub-file.
[0058] For example, such as Figure 3 As shown, Figure 3 The file record information contains three storage files, numbered 0, 1, and 2, respectively, meaning there are three file record information segments. This example uses storage file 0 as an example for specific illustration. Within the file record information segment corresponding to storage file 0, there are n sub-file record information segments corresponding to second resource sub-files. Each sub-file information segment for a second resource sub-file begins and ends with an Entry. In the sub-file record information of these n second resource sub-files, the aforementioned Path represents the original path of the second resource sub-file. Figure 3 The original paths of the n second resource sub-files are x1, x2, ..., xn; the Begin above is the starting position of the second resource sub-files in storage file 0. Figure 3 As can be seen, the storage starting position of the first second resource sub-file starts from 0. As the number of second resource sub-files increases, the corresponding storage starting position of each second resource sub-file also increases, until the storage starting position of the nth second resource sub-file is zzz; the Size mentioned above is the file memory of the second resource sub-file. Figure 3 This shows the file memory usage of each of the n second resource sub-files; the Index above represents the file number of the storage file where the second resource sub-file is stored. Figure 3 As can be seen from this, since all n second resource sub-files in the example are stored in storage file 0, the file number of each of the n second resource sub-files is 0; the MD5 hash above is the file content identifier of the second resource sub-file, from... Figure 3 The original paths of the n second resource sub-files are y1, y2, ..., yn. Furthermore, the specific structures of the file record information segments corresponding to storage file 1 and storage file 2 are identical to those of the file record information segment corresponding to storage file 0.
[0059] 203. Based on the file identifiers of the first resource sub-file and the second resource sub-file, perform a file identifier comparison.
[0060] In this embodiment, after obtaining the file identifiers of each first resource sub-file in the latest version resource file package of the target resource file, and the file identifiers of each second resource sub-file in the current version resource file package of the target resource file, it is necessary to determine which first resource sub-files in the latest version resource file package of the target resource file have changed by comparing the file identifiers. By comparing the file identifiers in this embodiment, the first resource sub-files that have changed can be quickly identified from the latest version resource file package.
[0061] Specifically, when the terminal compares the file identifiers based on the file identifiers of the first resource sub-file and the second resource sub-file, it may include: the terminal may search for the second resource sub-file that matches the file identifier in the file record information according to the file identifier of each first resource sub-file in the latest version of the resource file package, and compare them. If the file identifier of the first resource sub-file matches the file identifier of the second resource sub-file, it means that the first resource sub-file and the second resource sub-file with the same file identifier are the same resource file, but they may be different versions.
[0062] Understandably, terminal file identification comparison can clearly identify which first resource sub-files in the latest version of the resource file package have been modified, which first resource sub-files are newly added, and which second resource sub-files have been deleted compared to the current version of the resource file package. This allows for the adoption of corresponding technical measures to handle different file change methods.
[0063] 204. If the file identifier of the second resource sub-file contains a first file identifier that is not present in the first resource sub-file, then the sub-file record information of the second resource sub-file to which the first file identifier belongs is deleted from the file record information to update the file record information.
[0064] In this embodiment, if by comparing the identifiers, it is determined that at least one first file identifier in the file identifiers of each second resource sub-file of the current version resource file package does not exist in the file identifiers corresponding to the first resource sub-files of the latest version resource file package, that is, the first file identifier is not present in the file identifiers corresponding to each first resource sub-file, it means that the second resource sub-file to which the first file identifier belongs is not in the latest version resource file package, and the second resource sub-file to which the first file identifier belongs is a deleted resource file, that is, the second resource sub-file to which the first file identifier belongs has been deleted during the generation of the latest version resource file package.
[0065] In response, the terminal removes the sub-file record information of the second resource sub-file to which the first file identifier belongs from the file record information to indicate that the second resource sub-file to which the first file identifier belongs in the current version of the resource file package is a resource file that is no longer in use.
[0066] It should be noted that although resource files deleted during the generation of the latest version resource file package are no longer used, if only a portion of the resource files are deleted, it is still necessary to specifically find the resource file from the currently used resource file package on the game's local machine and delete it. This would undoubtedly consume a lot of file processing resources. Generally, deleted resource files only occupy a small amount of memory space. Therefore, in this embodiment, based on considerations of file update efficiency, when faced with a second resource sub-file to which the first file identifier belongs, simply delete the file information of that file from the file record information to clearly identify the second resource sub-file to which the first file identifier belongs as a resource file that is no longer used.
[0067] It is understandable that, due to the unique deletion strategy in this embodiment, in addition to the second resource sub-files that can be used normally by the game, there are also third resource sub-files that are not used by the game in the current version of the resource file package. These third resource sub-files are equivalent to the second resource sub-files to which the first file identifier belongs, meaning they are resource files deleted during each file update process when the latest version of the resource file is generated. The file information of this third resource sub-file is not recorded in the file record information.
[0068] In some embodiments, since the second resource sub-file can be stored in the storage file of the current version resource file package, and the file record information can also include a file record information segment corresponding to the storage file, the file record information segment includes a sub-file record information segment of the second resource sub-file located therein, which is used to record the sub-file record information of the second resource sub-file. Therefore, the above-mentioned deletion of the sub-file record information of the second resource sub-file to which the first file identifier belongs from the file record information can include: determining the target file record information segment of the storage of the second resource sub-file to which the first file identifier belongs based on the first file identifier; deleting the sub-file record information segment corresponding to the second resource sub-file to which the first file identifier belongs from the target file record information segment, thereby realizing the deletion of the sub-file record information of the second resource sub-file to which the first file identifier belongs.
[0069] In some embodiments, since there are third resource sub-files in the current version resource file package, that is, the files no longer exist in the file record information but are still in the current version resource file package, in order to avoid the gradual increase of unused third game resource sub-files and the resulting expansion of the target resource file package, and to improve the utilization rate of the storage file, a file recycling strategy can be further introduced in this embodiment. Since resource sub-files can be stored in the storage file of the current version resource file package, the memory occupied by the second resource sub-files currently in use in each storage file can be calculated in this embodiment. If the memory is too small, the storage file can be cleared, and the second resource sub-files in the storage file can be added as new files and merged with other files that need to be updated and updated to the storage file.
[0070] Specifically, the above-mentioned file update method may further include: calculating the total file memory corresponding to at least one of the above-mentioned file record information segments based on the file memory recorded in each sub-file record information segment of at least one of the above-mentioned file record information segments; identifying the storage files to which the file record information segments to which the total file memory is less than a preset memory threshold belong as storage files to be reclaimed; deleting each second resource sub-file in the above-mentioned storage files to be reclaimed, and deleting each sub-file record information segment in the file record information segment corresponding to the above-mentioned storage files to be reclaimed, and marking the storage files to be reclaimed as unused. Marking the storage files to be reclaimed as unused facilitates the continued use of unused storage files without resource files in the future.
[0071] It is understandable that the terminal can execute a file recycling strategy after deleting the sub-file record information of the second resource sub-file to which the first file identifier belongs, determine the storage file that conforms to the file recycling strategy among the storage files, and use the second resource sub-file in the storage file that conforms to the file recycling strategy as a new file; or, before obtaining the file record information in step 202, file recycling can be performed first to obtain the file record information after file recycling, and the file identifier of the second resource sub-file mentioned above in the file record information after file recycling can be compared with the file identifier of the first resource sub-file of the latest version resource file to obtain the new file, and then execute the subsequent steps. The specific settings can be set according to the requirements and are not limited here.
[0072] 205. If the file identifier of the first resource sub-file contains a second file identifier that the second resource sub-file does not contain, then update the first resource sub-file to which the second file identifier belongs to the current version resource file package, and update the file record information.
[0073] In this embodiment, if by comparing the identifiers, it is determined that at least one second file identifier in the file identifiers of each first resource sub-file of the latest version resource file package does not exist in the file identifiers of the second resource sub-files of the current version resource file package, that is, the second file identifier is not present in the file identifiers of each second resource sub-file, it means that the first resource sub-file to which the second file identifier belongs is not in the current version resource file package, and the first resource sub-file to which the second file identifier belongs is a newly added file, that is, the first resource sub-file to which the second file identifier belongs was added during the generation of the latest version resource file package.
[0074] To address this, the terminal updates the first resource sub-file to which the second file identifier belongs in the current version of the resource file package. Specifically, it adds a first resource sub-file to which the second file identifier belongs at a certain location in the current version of the resource file package, and adds sub-file record information of the first resource sub-file to which the second file identifier belongs at the corresponding location in the file record information, thereby updating the first resource sub-file to which the second file identifier belongs in the current version of the resource file package.
[0075] In some embodiments, since the resource sub-files can be stored in the storage file of the current version resource file package, updating the first resource sub-file to which the second file identifier belongs to the current version resource file package may include: adding a first target storage file in the current version resource file package, and updating the first resource sub-file to which the second file identifier belongs to the first target storage file of the current version resource file package.
[0076] Specifically, in order to clearly identify the storage file containing certain resource sub-files to be operated on during operation, it is necessary to determine the storage file number to which the first resource sub-file to which the second file identifier belongs is stored. That is, adding a first target storage file to the current version of the resource file package can include: determining the largest file number from the file numbers of at least one of the aforementioned storage files; determining the first target file number of the first target storage file based on the largest file number; and adding a first target storage file with the number of the first target file to the current version of the resource file package. Wherein, the first target file number is greater than the largest file number, and can be the sum of the largest file number and a preset number coefficient as the first target file number. For example, when the preset number coefficient is 1, the first target file number is the largest file number plus 1.
[0077] It is understandable that, since the memory capacity of the stored files is fixed, when storing the first resource sub-file to which the second file identifier belongs, there may be a situation where the file memory of the first resource sub-file to which the second file identifier belongs is greater than the memory capacity of the stored files. In this regard, the number of the first target stored files is determined based on the file memory of the first resource sub-file to which the second file identifier belongs, and the file numbers of a certain number of the first target stored files start from the first target file number and increase one by one. For example, if there are 3 first target stored files, and the maximum file number is 5, and the preset numbering coefficient is 1, then the file number of the first first target stored file is 6, the file number of the second first target stored file is 7, and the file number of the third first target stored file is 8.
[0078] In some embodiments, since there may be unused storage files in the current version resource file package, the step 205 above, which updates the first resource sub-file to which the second file identifier belongs to the current version resource file package, may further include: if there are unused storage files in the current version resource file package, then update the first resource sub-file to which the second file identifier belongs to the unused storage files.
[0079] 206. If the contents of the first resource sub-file and the second resource sub-file with the same file identifier are different, then the first resource sub-file with different contents will be updated to the above-mentioned current version resource file package, and the above-mentioned file record information will be updated.
[0080] In this embodiment, if by comparing the identifiers, it is determined that the file content of at least one first resource sub-file with the same file identifier is different from that of the second resource sub-file, it means that the file content of the first resource sub-file with the same file identifier has been modified compared to the second resource sub-file. The first resource sub-file with different file content is a modified file, that is, the first resource sub-file with different file content was modified in the process of generating the latest version of the resource file package.
[0081] To address this, the terminal updates the first resource sub-file with different file content to the current version of the resource file package. Specifically, it adds a first resource sub-file with different file content at a certain position in the current version of the resource file package and adds sub-file record information of the first resource sub-file with different file content to the corresponding position in the file record information, thereby updating the first resource sub-file with different file content in the current version of the resource file package.
[0082] In some embodiments, to improve the comparison speed of file content between a first resource sub-file and a second resource sub-file with the same file identifier, the file content identifier included in the sub-file record information can be used. That is, if the file content of the first resource sub-file and the second resource sub-file with the same file identifier is different, the first resource sub-file with different file content is updated to the current version of the resource file package, and the file record information is updated. This can include: determining the file content identifier of the first resource sub-file with the same file identifier based on the file identifier of the first resource sub-file with the same file identifier; determining the corresponding target sub-file record information based on the file identifier of the second resource sub-file with the same file identifier, and querying the file content identifier of the second resource sub-file with the same file identifier from the target sub-file record information; if the file content identifiers of the first resource sub-file and the second resource sub-file with the same file identifier are different, the first resource sub-file with different file content identifier is updated to the current version of the resource file package, and the file record information is updated.
[0083] Specifically, determining the file content identifier of the first resource sub-file with the same file identifier based on the file identifier of the first resource sub-file with the same file identifier may include: querying the corresponding file content based on the file identifier of the first resource sub-file with the same file identifier, and calculating the corresponding file content identifier based on the file content.
[0084] In some embodiments, since resource sub-files can be stored in the storage file of the current version resource file package, updating the first resource sub-file with different file content to the current version resource file package may include: adding a second target storage file in the current version resource file package, and updating the first resource sub-file with different file content to the second target storage file of the current version resource file package.
[0085] Specifically, in order to clearly identify the storage file containing certain resource sub-files to be operated on during operation, it is necessary to determine the storage file number of the first resource sub-file with different file content. That is, adding a second target storage file to the current version of the resource file package can include: determining the largest file number from the file numbers of at least one of the above storage files; determining the second target file number of the second target storage file based on the largest file number; and adding a second target storage file with the number of the second target file to the current version of the resource file package. Wherein, the second target file number is greater than the largest file number, and can be the sum of the largest file number and a preset number coefficient as the second target file number. For example, when the preset number coefficient is 1, the second target file number is the largest file number plus 1.
[0086] It is understandable that, since the memory capacity of the stored files is fixed, when storing first resource sub-files with different file contents, there may be situations where the file memory of the first resource sub-files with different file contents is greater than the memory capacity of the stored files. In this regard, the number of the second target stored files is determined based on the file memory of the first resource sub-files with different file contents, and the file numbers of a certain number of second target stored files start from the second target file number and increase sequentially. For example, if there are 3 second target stored files, and the maximum file number is 10, and the preset numbering coefficient is 1, then the file number of the first second target stored file is 11, the file number of the second second target stored file is 12, and the file number of the third second target stored file is 13.
[0087] In some embodiments, since there may be unused storage files in the current version resource file package, the step 206 above, which updates the first resource sub-file with different file content to the current version resource file package, may further include: if there are unused storage files in the current version resource file package, then update the first resource sub-file with different file content to the unused storage files.
[0088] In some embodiments, steps 204, 205, and 206 can be performed simultaneously and independently, sequentially, or nested within each other, depending on the specific requirements. This allows for resource updates without the need to download existing game resources. Instead, the system directly downloads the first resource sub-file to be updated, merging it with the latest version resource file package and some resource sub-files from the current version resource file package. This results in a usable latest version resource file package containing both the updated first resource sub-file and the undeleted second resource sub-file, thus avoiding wasted download resources during game resource updates.
[0089] It is understood that the aforementioned nested operation can specifically include the following: when the terminal determines in steps 205 and 206 that the first resource sub-file to be updated (i.e., the first resource sub-file to which the second file identifier belongs and the first resource sub-file with different file content), the first resource sub-file to be updated is merged together and updated together. That is, the first target storage file and the second target storage file can be the same storage file, or they can be modified based on the file memory of the first resource sub-file to be updated. Furthermore, when the terminal determines in steps 204, 205, and 206 that the sub-file record information to be modified in the file record information (i.e., the sub-file record information of the second resource sub-file to which the first file identifier belongs, the sub-file record information of the first resource sub-file to which the second file identifier belongs, and the sub-file record information of the first resource sub-file with different file content), the information to be modified is merged together and modified together.
[0090] For example, if the preset numbering coefficient is set to 1, and the file number of the storage file containing the above file record information is 0 to N, then during the update, it is not necessary to repeatedly update the second resource sub-file in the storage file corresponding to 0 to N. Instead, the first resource sub-file to which the second file identifier belongs and / or the first resource sub-file with different file content will be updated to the storage file numbered N+1 and the storage file numbered N+2, until the storage of the first resource sub-file that needs to be updated is completed.
[0091] As can be seen from the above, by obtaining the file identifiers of each first resource sub-file in the latest version of the target resource file's resource file package, and then obtaining the file record information corresponding to the current version of the target resource file's resource file package, the file record information includes the sub-file record information of each second resource sub-file in the current version of the resource file package. This sub-file record information includes file identifiers. Thus, by recording various information about the files in the current version of the resource file through this file record information, and comparing the file identifiers of the first and second resource sub-files, it is possible to conveniently determine which files in the latest version of the resource file package have been changed, improving the speed of determining changed files. If the file identifiers of the second resource sub-files contain first file identifiers that are not present in the first resource sub-files, then the sub-file record information of the second resource sub-file to which the first file identifier belongs is deleted from the file record information to update the file record information. Therefore, only the sub-file record information corresponding to the deleted file needs to be deleted, achieving the updating of deleted files. If the file identifier of the first resource sub-file contains a second file identifier that the second resource sub-file does not have, then the first resource sub-file to which the second file identifier belongs is updated in the current version resource file package, and the file record information is updated. This allows for the identification of newly added files based on the file identifier, ensuring that only newly added files are updated. If the content of the first and second resource sub-files with the same file identifier differs, then the first resource sub-file with the different content is updated in the current version resource file package, and the file record information is updated. This allows for the identification of modified files based on the file identifier, ensuring that only modified files are updated. Therefore, when updating game resources, there is no need to expend download resources to download existing game resources, avoiding waste of download resources during game resource updates.
[0092] To better implement the above methods, this application also provides a file update device, which can be integrated into an electronic device, such as a computer device, which can be a terminal, server, or other device.
[0093] The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers.
[0094] For example, in this embodiment, the method of this application embodiment will be described in detail by taking the file update device specifically integrated into the terminal as an example. This embodiment provides a file update device, such as... Figure 4 As shown, the file update device may include:
[0095] The identifier acquisition module 401 is used to acquire the file identifiers of each first resource sub-file in the latest version resource file package of the target resource file;
[0096] Information acquisition module 402 is used to acquire file record information corresponding to the current version resource file package of the target resource file. The file record information includes sub-file record information of each second resource sub-file in the current version resource file package. The sub-file record information includes file identifier.
[0097] The identifier comparison module 403 is used to compare file identifiers based on the file identifiers of the first resource sub-file and the second resource sub-file.
[0098] The information deletion module 404 is used to delete the sub-file record information of the second resource sub-file to which the first file identifier belongs from the file record information if the file identifier of the second resource sub-file contains a first file identifier that is not present in the first resource sub-file, so as to update the file record information.
[0099] The first file update module 405 is used to update the first resource sub-file to which the second file identifier belongs to the current version of the resource file package and update the file record information if the file identifier of the first resource sub-file contains a second file identifier that the second resource sub-file does not have.
[0100] The second file update module 406 is used to update the first resource sub-file with different file content to the current version resource file package and update the file record information if the file content of the first resource sub-file with the same file identifier and the second resource sub-file are different.
[0101] In some embodiments, the current version resource file package further includes at least one storage file, which is used to store the second resource sub-file, and the first file update module 405 is specifically used for:
[0102] A new first target storage file is added to the above-mentioned current version resource file package, and the first resource sub-file to which the above-mentioned second file identifier belongs is updated to the first target storage file of the above-mentioned current version resource file package;
[0103] The aforementioned second file update module 406 is specifically used for:
[0104] A second target storage file is added to the current version resource file package, and the first resource sub-file with different file content is updated to the second target storage file of the current version resource file package.
[0105] In some embodiments, the file record information further includes at least one file number of the stored file, and the first file update module 405 is specifically used for:
[0106] Determine the largest file number from the file numbers of at least one of the aforementioned stored files, and determine the first target file number of the aforementioned first target stored file based on the largest file number;
[0107] Add a first target storage file with the number of the first target file mentioned above to the current version resource file package;
[0108] The aforementioned second file update module 406 is specifically used for:
[0109] Determine the largest file number from the file numbers of at least one of the aforementioned stored files, and determine the second target file number of the aforementioned second target stored file based on the largest file number;
[0110] Add a second target storage file with the same number as the second target file in the current version resource file package.
[0111] In some embodiments, the file record information further includes at least one file record information segment corresponding to the storage file, wherein the file record information segment includes a sub-file record information segment of at least one of the second resource sub-files located in the storage file, and the sub-file record information segment records the sub-file record information of the second resource sub-file; the information deletion module 404 is specifically used for:
[0112] Based on the aforementioned first file identifier, the target file record information segment of the second resource sub-file to which the aforementioned first file identifier belongs is determined;
[0113] In the aforementioned target file record information segment, delete the sub-file record information segment corresponding to the second resource sub-file to which the first file identifier belongs.
[0114] In some embodiments, the sub-file record information further includes file memory, and the file update device further includes a file recycling module, which is specifically used for:
[0115] Based on the file memory recorded in each sub-file record information segment of at least one of the above-mentioned file record information segments, calculate the total file memory corresponding to at least one of the above-mentioned file record information segments;
[0116] Files whose total file memory is less than a preset memory threshold are identified as storage files to be reclaimed.
[0117] Delete each of the second resource sub-files in the above-mentioned storage file to be reclaimed, and delete each of the sub-file record information segments in the file record information segment corresponding to the above-mentioned storage file to be reclaimed, and mark the storage file to be reclaimed as unused.
[0118] In some embodiments, the first file update module 405 is specifically used for:
[0119] If there are unused storage files in the current version resource file package, then update the first resource sub-file to which the second file identifier belongs to the unused storage file.
[0120] The aforementioned second file update module 406 is specifically used for:
[0121] If there are unused storage files in the current version resource file package, then the first resource sub-file with different file content will be updated to the unused storage file.
[0122] In some embodiments, the sub-file record information further includes a file content identifier, and the second file update module 406 is specifically used for:
[0123] Based on the file identifier of the first resource sub-file with the same file identifier, determine the file content identifier of the first resource sub-file with the same file identifier.
[0124] Based on the file identifier of the second resource sub-file with the same file identifier, determine the corresponding target sub-file record information, and query the file content identifier of the second resource sub-file with the same file identifier from the target sub-file record information;
[0125] If the file content identifiers of the first resource sub-file and the second resource sub-file with the same file identifier are different, then the first resource sub-file with the different file content identifier will be updated to the current version resource file package, and the file record information will be updated.
[0126] As can be seen from the above, the file update device in this embodiment obtains the file identifiers of each first resource sub-file in the latest version resource file package of the target resource file through the identifier acquisition module 401. Then, it obtains the file record information corresponding to the current version resource file package of the target resource file through the information acquisition module 402. The file record information includes the sub-file record information of each second resource sub-file in the current version resource file package. The sub-file record information includes the file identifier. Thus, the file record information records various information of the file in the current version resource file. The identifier comparison module 403 compares the file identifiers of the first resource sub-file and the second resource sub-file, thereby conveniently determining which files in the latest version resource file package have been changed, improving the speed of determining changed files. The information deletion module 404 is used to delete the sub-file record information of the second resource sub-file to which the first file identifier belongs from the file record information if the file identifier of the second resource sub-file contains a first file identifier that the first resource sub-file does not have, thereby updating the file record information. Thus, only the sub-file record information corresponding to the file needs to be deleted, realizing the updating of deleted files. The first file update module 405 is used to update the first resource sub-file to the current version resource file package if the file identifier of the first resource sub-file contains a second file identifier that the second resource sub-file does not have, and to update the file record information. This allows for the identification of newly added files based on the file identifier, so that only newly added files are updated. The second file update module 406 is used to update the first resource sub-file to the current version resource file package if the file content of the first and second resource sub-files with the same file identifier is different, and to update the file record information. This allows for the identification of modified files based on the file identifier, so that only modified files are updated. Therefore, when updating game resources, it is not necessary to spend download resources to download existing game resources, avoiding the waste of download resources during game resource updates.
[0127] Accordingly, this application also provides an electronic device, which can be a terminal, such as a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. Figure 5 As shown, Figure 5This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 500 includes a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. The processor 501 and the memory 502 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0128] The processor 501 is the control center of the electronic device 500. It connects various parts of the electronic device 500 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, it performs various functions of the electronic device 500 and processes data, thereby monitoring the electronic device 500 as a whole.
[0129] In this embodiment, the processor 501 in the electronic device 500 loads the instructions corresponding to the processes of one or more applications into the memory 502 according to the following steps, and the processor 501 runs the applications stored in the memory 502 to achieve various functions:
[0130] Obtain the file identifiers of each first resource sub-file in the latest version resource file package of the target resource file;
[0131] Obtain the file record information corresponding to the current version resource file package of the above target resource file. The file record information includes the sub-file record information of each second resource sub-file in the current version resource file package. The sub-file record information includes the file identifier.
[0132] Based on the file identifiers of the first resource sub-file and the second resource sub-file, a file identifier comparison is performed;
[0133] If the file identifier of the second resource sub-file contains a first file identifier that is not present in the first resource sub-file, then the sub-file record information of the second resource sub-file to which the first file identifier belongs is deleted from the file record information to update the file record information;
[0134] If the file identifier of the first resource sub-file contains a second file identifier that the second resource sub-file does not have, then the first resource sub-file to which the second file identifier belongs will be updated in the current version resource file package, and the file record information will be updated.
[0135] If the contents of the first resource sub-file and the second resource sub-file with the same file identifier are different, then the first resource sub-file with different contents will be updated to the current version of the resource file package, and the file record information will be updated.
[0136] In some embodiments, the current version resource file package further includes at least one storage file, which stores the second resource sub-file. Updating the first resource sub-file to which the second file identifier belongs to the current version resource file package includes:
[0137] A new first target storage file is added to the current version resource file package, and the first resource sub-file to which the second file identifier belongs is updated to the first target storage file of the current version resource file package;
[0138] The above-mentioned updating of the first resource sub-file with different file content to the above-mentioned current version resource file package includes:
[0139] A second target storage file is added to the current version resource file package, and the first resource sub-file with different file content is updated to the second target storage file of the current version resource file package.
[0140] In some embodiments, the file record information further includes at least one file number of the stored file, and the addition of the first target stored file to the current version resource file package includes:
[0141] Determine the largest file number from the file numbers of at least one of the aforementioned stored files, and determine the first target file number of the aforementioned first target stored file based on the largest file number;
[0142] Add a first target storage file with the number of the first target file mentioned above to the current version resource file package;
[0143] The above-mentioned addition of a second target storage file to the current version resource file package includes:
[0144] Determine the largest file number from the file numbers of at least one of the aforementioned stored files, and determine the second target file number of the aforementioned second target stored file based on the largest file number;
[0145] Add a second target storage file with the same number as the second target file in the current version resource file package.
[0146] In some embodiments, the file record information further includes at least one file record information segment corresponding to the storage file, wherein the file record information segment includes a sub-file record information segment of at least one of the second resource sub-files located in the storage file, and the sub-file record information segment records the sub-file record information of the second resource sub-file.
[0147] The deletion of the sub-file record information of the second resource sub-file to which the first file identifier belongs from the above file record information includes:
[0148] Based on the aforementioned first file identifier, the target file record information segment of the second resource sub-file to which the aforementioned first file identifier belongs is determined;
[0149] In the aforementioned target file record information segment, delete the sub-file record information segment corresponding to the second resource sub-file to which the first file identifier belongs.
[0150] In some embodiments, the sub-file record information mentioned above also includes file memory, and further includes:
[0151] Based on the file memory recorded in each sub-file record information segment of at least one of the above-mentioned file record information segments, calculate the total file memory corresponding to at least one of the above-mentioned file record information segments;
[0152] Files whose total file memory is less than a preset memory threshold are identified as storage files to be reclaimed.
[0153] Delete each of the second resource sub-files in the above-mentioned storage file to be reclaimed, and delete each of the sub-file record information segments in the file record information segment corresponding to the above-mentioned storage file to be reclaimed, and mark the storage file to be reclaimed as unused.
[0154] In some embodiments, updating the first resource sub-file to which the second file identifier belongs to the current version resource file package further includes:
[0155] If there are unused storage files in the current version resource file package, then update the first resource sub-file to which the second file identifier belongs to the unused storage file.
[0156] The above-mentioned updating of the first resource sub-file with different file content to the current version resource file package also includes:
[0157] If there are unused storage files in the current version resource file package, then the first resource sub-file with different file content will be updated to the unused storage file.
[0158] In some embodiments, the sub-file record information further includes a file content identifier. If the file content of the first resource sub-file and the second resource sub-file with the same file identifier is different, the first resource sub-file with different file content is updated to the current version of the resource file package, and the file record information is updated, including:
[0159] Based on the file identifier of the first resource sub-file with the same file identifier, determine the file content identifier of the first resource sub-file with the same file identifier.
[0160] Based on the file identifier of the second resource sub-file with the same file identifier, determine the corresponding target sub-file record information, and query the file content identifier of the second resource sub-file with the same file identifier from the target sub-file record information;
[0161] If the file content identifiers of the first resource sub-file and the second resource sub-file with the same file identifier are different, then the first resource sub-file with the different file content identifier will be updated to the current version resource file package, and the file record information will be updated.
[0162] Therefore, the electronic device 500 provided in this embodiment can bring the following technical effects: it avoids the waste of download resources when updating game resources.
[0163] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0164] Optional, such as Figure 5 As shown, the electronic device 500 also includes: a touch display screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch display screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507. Those skilled in the art will understand that... Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0165] The touch display screen 503 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 503 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 501. It can also receive and execute commands from the processor 501. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 501 to determine the type of touch event. Subsequently, the processor 501 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 503 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 503 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 503 can also be used as part of the input unit 506 to achieve input functions.
[0166] The radio frequency circuit 504 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.
[0167] Audio circuitry 505 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 505 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 505, converted back into audio data, and then processed by processor 501 before being transmitted via radio frequency circuitry 504 to, for example, another electronic device, or output to memory 502 for further processing. Audio circuitry 505 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.
[0168] The input unit 506 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0169] Power supply 507 is used to supply power to various components of electronic device 500. Optionally, power supply 507 can be logically connected to processor 501 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 507 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0170] although Figure 5 As not shown in the diagram, the electronic device 500 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0171] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0172] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0173] Therefore, embodiments of this application provide a computer-readable storage medium storing multiple computer programs that can be loaded by a processor to execute any of the file update methods provided in embodiments of this application. For example, the computer program can perform the following steps:
[0174] Obtain the file identifiers of each first resource sub-file in the latest version resource file package of the target resource file;
[0175] Obtain the file record information corresponding to the current version resource file package of the above target resource file. The file record information includes the sub-file record information of each second resource sub-file in the current version resource file package. The sub-file record information includes the file identifier.
[0176] Based on the file identifiers of the first resource sub-file and the second resource sub-file, a file identifier comparison is performed;
[0177] If the file identifier of the second resource sub-file contains a first file identifier that is not present in the first resource sub-file, then the sub-file record information of the second resource sub-file to which the first file identifier belongs is deleted from the file record information to update the file record information;
[0178] If the file identifier of the first resource sub-file contains a second file identifier that the second resource sub-file does not have, then the first resource sub-file to which the second file identifier belongs will be updated in the current version resource file package, and the file record information will be updated.
[0179] If the contents of the first resource sub-file and the second resource sub-file with the same file identifier are different, then the first resource sub-file with different contents will be updated to the current version of the resource file package, and the file record information will be updated.
[0180] In some embodiments, the current version resource file package further includes at least one storage file, which stores the second resource sub-file. Updating the first resource sub-file to which the second file identifier belongs to the current version resource file package includes:
[0181] A new first target storage file is added to the current version resource file package, and the first resource sub-file to which the second file identifier belongs is updated to the first target storage file of the current version resource file package;
[0182] The above-mentioned updating of the first resource sub-file with different file content to the above-mentioned current version resource file package includes:
[0183] A second target storage file is added to the current version resource file package, and the first resource sub-file with different file content is updated to the second target storage file of the current version resource file package.
[0184] In some embodiments, the file record information further includes at least one file number of the stored file, and the addition of the first target stored file to the current version resource file package includes:
[0185] Determine the largest file number from the file numbers of at least one of the aforementioned stored files, and determine the first target file number of the aforementioned first target stored file based on the largest file number;
[0186] Add a first target storage file with the number of the first target file mentioned above to the current version resource file package;
[0187] The above-mentioned addition of a second target storage file to the current version resource file package includes:
[0188] Determine the largest file number from the file numbers of at least one of the aforementioned stored files, and determine the second target file number of the aforementioned second target stored file based on the largest file number;
[0189] Add a second target storage file with the same number as the second target file in the current version resource file package.
[0190] In some embodiments, the file record information further includes at least one file record information segment corresponding to the storage file, wherein the file record information segment includes a sub-file record information segment of at least one of the second resource sub-files located in the storage file, and the sub-file record information segment records the sub-file record information of the second resource sub-file.
[0191] The deletion of the sub-file record information of the second resource sub-file to which the first file identifier belongs from the above file record information includes:
[0192] Based on the aforementioned first file identifier, the target file record information segment of the second resource sub-file to which the aforementioned first file identifier belongs is determined;
[0193] In the aforementioned target file record information segment, delete the sub-file record information segment corresponding to the second resource sub-file to which the first file identifier belongs.
[0194] In some embodiments, the sub-file record information mentioned above also includes file memory, and further includes:
[0195] Based on the file memory recorded in each sub-file record information segment of at least one of the above-mentioned file record information segments, calculate the total file memory corresponding to at least one of the above-mentioned file record information segments;
[0196] Files whose total file memory is less than a preset memory threshold are identified as storage files to be reclaimed.
[0197] Delete each of the second resource sub-files in the above-mentioned storage file to be reclaimed, and delete each of the sub-file record information segments in the file record information segment corresponding to the above-mentioned storage file to be reclaimed, and mark the storage file to be reclaimed as unused.
[0198] In some embodiments, updating the first resource sub-file to which the second file identifier belongs to the current version resource file package further includes:
[0199] If there are unused storage files in the current version resource file package, then update the first resource sub-file to which the second file identifier belongs to the unused storage file.
[0200] The above-mentioned updating of the first resource sub-file with different file content to the current version resource file package also includes:
[0201] If there are unused storage files in the current version resource file package, then the first resource sub-file with different file content will be updated to the unused storage file.
[0202] In some embodiments, the sub-file record information further includes a file content identifier. If the file content of the first resource sub-file and the second resource sub-file with the same file identifier is different, the first resource sub-file with different file content is updated to the current version of the resource file package, and the file record information is updated, including:
[0203] Based on the file identifier of the first resource sub-file with the same file identifier, determine the file content identifier of the first resource sub-file with the same file identifier.
[0204] Based on the file identifier of the second resource sub-file with the same file identifier, determine the corresponding target sub-file record information, and query the file content identifier of the second resource sub-file with the same file identifier from the target sub-file record information;
[0205] If the file content identifiers of the first resource sub-file and the second resource sub-file with the same file identifier are different, then the first resource sub-file with the different file content identifier will be updated to the current version resource file package, and the file record information will be updated.
[0206] As can be seen, the computer program can be loaded by the processor to execute any of the file update methods provided in the embodiments of this application, thereby bringing the following technical effects: avoiding the waste of download resources when updating game resources.
[0207] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0208] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0209] Since the computer program stored in the computer-readable storage medium can execute any of the file update methods provided in the embodiments of this application, the beneficial effects that any of the file update methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0210] The foregoing has provided a detailed description of a file update method, apparatus, electronic device, and computer-readable storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A file update method, characterized in that, The method includes: Obtain the file identifiers of each first resource sub-file in the latest version resource file package of the target resource file; Obtain file record information corresponding to the current version resource file package of the target resource file. The current version resource file package also includes at least one storage file. The storage file is used to store the second resource sub-file in the current version resource file. The file record information also includes at least one file record information segment corresponding to the storage file. The file record information segment includes a sub-file record information segment of at least one second resource sub-file located in the storage file. The sub-file record information segment records the sub-file record information of the second resource sub-file. The sub-file record information includes at least a file identifier. Based on the file identifiers of the first resource sub-file and the second resource sub-file, a file identifier comparison is performed; If the file identifier of the second resource sub-file contains a first file identifier that is not present in the first resource sub-file, then the sub-file record information of the second resource sub-file to which the first file identifier belongs is deleted from the file record information to update the file record information; If the file identifier of the first resource sub-file contains a second file identifier that the second resource sub-file does not have, then the first resource sub-file to which the second file identifier belongs is updated in the current version resource file package, and the file record information is updated; If the contents of the first resource sub-file and the second resource sub-file with the same file identifier are different, then the first resource sub-file with different contents is updated to the current version of the resource file package, and the file record information is updated.
2. The file update method as described in claim 1, characterized in that, The step of updating the first resource sub-file to which the second file identifier belongs to the current version of the resource file package includes: A first target storage file is added to the current version resource file package, and the first resource sub-file to which the second file identifier belongs is updated to the first target storage file of the current version resource file package; The step of updating the first resource sub-file with different file content to the current version resource file package includes: A second target storage file is added to the current version resource file package, and the first resource sub-file with different file content is updated to the second target storage file of the current version resource file package.
3. The file update method as described in claim 2, characterized in that, The file record information also includes at least one file number of the stored file, and the step of adding a first target stored file to the current version resource file package includes: Determine the largest file number from the file numbers of at least one of the stored files, and determine the first target file number of the first target stored file based on the largest file number; Add a first target storage file with the number of the first target file to the current version resource file package; The step of adding a second target storage file to the current version resource file package includes: Determine the largest file number from the file numbers of at least one of the stored files, and determine the second target file number of the second target stored file based on the largest file number; A second target storage file with the number of the second target file is added to the current version resource file package.
4. The file update method as described in claim 2, characterized in that, The step of deleting the sub-file record information of the second resource sub-file to which the first file identifier belongs from the file record information includes: Based on the first file identifier, determine the target file record information segment of the second resource sub-file to which the first file identifier belongs; In the target file record information segment, delete the sub-file record information segment corresponding to the second resource sub-file to which the first file identifier belongs.
5. The file update method as described in claim 4, characterized in that, The sub-file record information also includes file memory, and further includes: Based on the file memory recorded in each sub-file record information segment of at least one of the file record information segments, calculate the total file memory corresponding to at least one of the file record information segments; Files whose total file memory is less than a preset memory threshold are identified as storage files to be reclaimed. Delete each second resource sub-file in the storage file to be reclaimed, delete each sub-file record information segment in the file record information segment corresponding to the storage file to be reclaimed, and mark the storage file to be reclaimed as unused.
6. The file update method as described in claim 5, characterized in that, The step of updating the first resource sub-file to which the second file identifier belongs to the current version resource file package further includes: If there are unused storage files in the current version resource file package, then the first resource sub-file to which the second file identifier belongs will be updated to the unused storage file; The step of updating the first resource sub-file with different file content to the current version resource file package also includes: If there are unused storage files in the current version resource file package, then the first resource sub-file with different file content will be updated to the unused storage file.
7. The file update method according to any one of claims 1 to 6, characterized in that, The sub-file record information also includes a file content identifier. If the file content of the first resource sub-file and the second resource sub-file with the same file identifier is different, then the first resource sub-file with the different file content is updated to the current version of the resource file package, and the file record information is updated, including: Based on the file identifier of the first resource sub-file with the same file identifier, determine the file content identifier of the first resource sub-file with the same file identifier; Based on the file identifier of the second resource sub-file with the same file identifier, determine the corresponding target sub-file record information, and query the file content identifier of the second resource sub-file with the same file identifier from the target sub-file record information; If the file content identifiers of the first resource sub-file and the second resource sub-file with the same file identifier are different, then the first resource sub-file with the different file content identifier is updated to the current version resource file package, and the file record information is updated.
8. A file updating device, characterized in that, The device includes: The identifier acquisition module is used to obtain the file identifiers of each first resource sub-file in the latest version resource file package of the target resource file; The information acquisition module is used to acquire file record information corresponding to the current version resource file package of the target resource file. The file record information includes at least one storage file in the current version resource file package. The storage file is used to store a second resource sub-file in the current version resource file. The file record information also includes at least one file record information segment corresponding to the storage file. The file record information segment includes a sub-file record information segment of at least one second resource sub-file located in the storage file. The sub-file record information segment records the sub-file record information of the second resource sub-file. The sub-file record information includes at least a file identifier. The identifier comparison module is used to compare file identifiers based on the file identifiers of the first resource sub-file and the file identifiers of the second resource sub-file; The information deletion module is used to delete the sub-file record information of the second resource sub-file to which the first file identifier belongs from the file record information if the file identifier of the second resource sub-file contains a first file identifier that the first resource sub-file does not have, so as to update the file record information; The first file update module is used to update the first resource sub-file to which the second file identifier belongs to the current version of the resource file package and update the file record information if the file identifier of the first resource sub-file contains a second file identifier that the second resource sub-file does not have. The second file update module is used to update the first resource sub-file with different file content to the current version resource file package and update the file record information if the file content of the first resource sub-file and the second resource sub-file with the same file identifier is different.
9. An electronic device, characterized in that, The system includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to perform the file update method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the file update method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Application update package generation method and device and application update method and device
CN106708581A
Application updating method and device, electronic equipment and computer readable storage medium
CN114625402A