File packaging method and device, file updating method and device, equipment and storage medium

By adjusting the change file of reference package system and upgrade resource files, only resource subcontracting with too much invalid data is repackaged, which solves the problem of time-consuming repackaging of resource packages in software version updates, and achieves efficient resource updates and optimized user experience.

CN119883352APending Publication Date: 2025-04-25珠海剑心互动娱乐有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411826996.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

During the software version update process, whenever the resource file in the resource package changes, the resource package needs to be repackaged, resulting in an increase in time and a large amount of downloaded data, which affects the update efficiency and user experience.

Method used

By referring to the package system and upgrade resource files, the change files are determined and the reference directory table is adjusted. Only resource subcontracts with too much invalid data are repackaged, and the upgrade directory table and the second resource subcontract are generated to reduce unnecessary resource subcontract updates.

Benefits of technology

It effectively reduces the time-consuming repackaging, avoids excessive data redundancy, reduces the amount of downloaded data, saves network resources, and significantly improves update efficiency and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883352A_ABST
    Figure CN119883352A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a file packaging method and device, a file updating method and device, equipment and a storage medium. The method comprises the steps of obtaining a reference package system and a plurality of upgrading resource files; determining a change file in the original resource file and the upgrade resource file based on the reference package system and the upgrade resource file, and adjusting a reference directory table based on the change file; determining the size of invalid data of each first resource subpackage based on the adjusted reference directory table; for each first resource sub-package, when the size of invalid data of the first resource sub-package is greater than or equal to a preset repackaging threshold value, repackaging the first resource sub-package based on the change file to obtain a second resource sub-package; and generating an upgrade directory table based on the adjusted reference directory table and the second resource subpackage, and when an update request is received, sending the upgrade directory table and the second resource subpackage. The embodiment of the invention can reduce the time consumption, thereby improving the updating efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to, but is not limited to, the field of computer technology, and in particular to a file packaging method, a file updating method, a device, a equipment, and a storage medium. Background Art

[0002] In the process of computer software development and maintenance, version updates are common operations, especially in game software, where version updates are very frequent. In order to effectively manage resource files, it is usually necessary to package and merge multiple resource files into a larger resource package. Currently, when the software version is updated, every time the resource files in the resource package change, the resource package needs to be repackaged. This method is not only time-consuming, but also requires users to download the entire new version of the resource package for replacement, resulting in a large amount of downloaded data, which will significantly increase the download time, resulting in low update efficiency and affecting user experience. Summary of the invention

[0003] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.

[0004] The embodiments of the present application provide a file packaging method, a file updating method, an apparatus, a device and a storage medium, which can reduce time consumption and thus improve update efficiency.

[0005] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application proposes a file packaging method, comprising: obtaining a reference package system and a plurality of upgraded resource files, wherein the reference package system comprises a reference directory table and a plurality of first resource subpackages for storing original resource files, and the reference directory table is used to associate each of the original resource files; based on the reference package system and the upgraded resource files, determining a change file in the original resource file and the upgraded resource file, and adjusting the reference directory table based on the change file; determining the invalid data size of each of the first resource subpackages based on the adjusted reference directory table, wherein the invalid data size is negatively correlated with the sum of the data sizes of all the original resource files associated with the reference directory table in the first resource subpackage; for each of the first resource subpackages, when the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, repackaging the first resource subpackage based on the change file to obtain a second resource subpackage; generating an upgrade directory table based on the adjusted reference directory table and the second resource subpackage, and sending the upgrade directory table and the second resource subpackage when an update request is received.

[0006] In some embodiments, the reference directory table includes a first directory entry for each of the original resource files, the first directory entry includes a path and a check value corresponding to the original resource file, the changed file includes a newly added file, a deleted file, a file to be changed, and a modified file, the changed file is determined in the original resource file and the upgraded resource file based on the reference package system and the upgraded resource file, and the reference directory table is adjusted based on the changed file, including: comparing the path corresponding to the original resource file with the path corresponding to the upgraded resource file to obtain a first comparison result; comparing the check value corresponding to the original resource file with the check value corresponding to the upgraded resource file to obtain a second comparison result; based on the first comparison result, A comparison result is provided, wherein the deleted file is determined in each of the original resource files, and the newly added file is determined in each of the upgraded resource files, wherein the path between the deleted file and any one of the upgraded resource files is different, and the path between the newly added file and any one of the original resource files is different; based on the first comparison result and the second comparison result, the file to be modified is determined in each of the original resource files, and the modified file corresponding to the file to be modified is determined in each of the upgraded resource files, wherein the path between the file to be modified and the corresponding modified file is the same and the check value is different; in the reference directory table, the first directory items corresponding to the deleted file and the file to be modified are eliminated.

[0007] In some embodiments, the first directory item includes the data size corresponding to the original resource file, and determining the invalid data size of each of the first resource subpackages based on the adjusted reference directory table includes: determining the valid data size of each of the first resource subpackages based on the first directory item, wherein the valid data size is the sum of the data sizes of all the original resource files associated with the reference directory table in the first resource subpackage, and the original resource file associated with the reference directory table refers to the file for which the corresponding first directory item exists; for each of the first resource subpackages, when the file size of the first resource subpackage is less than or equal to a preset subpackage threshold, determining the difference between the subpackage threshold and the valid data size as the invalid data size of the first resource subpackage, or, when the file size of the first resource subpackage is greater than the subpackage threshold, determining the difference between the file size of the first resource subpackage and the valid data size as the invalid data size of the first resource subpackage.

[0008] In some embodiments, after determining the changed files in the original resource file and the upgraded resource file based on the reference package system and the upgraded resource file, the file packaging method further includes: registering the newly added files and the modified files into a preset update pool; when the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, repackaging the first resource subpackage based on the changed files to obtain a second resource subpackage, including: when the invalid data size of the first resource subpackage is greater than or equal to the preset repackaging threshold, registering the valid files in the first resource subpackage into the update pool, and removing the first directory item corresponding to the valid file, wherein the valid file is the original resource file with the corresponding first directory item; allocating unallocated resource files in the update pool to the first resource subpackage until there are no unallocated resource files in the update pool, or until the sum of the data sizes of all resource files allocated to the first resource subpackage is greater than or equal to the preset subpackage threshold; removing all files in the first resource subpackage, and writing all resource files allocated to the first resource subpackage into the first resource subpackage to obtain the second resource subpackage.

[0009] In some embodiments, when the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, the first resource subpackage is repackaged based on the change file to obtain the second resource subpackage. The file packaging method also includes: when there are unallocated resource files in the update pool, the unallocated resource files in the update pool are allocated to the newly added second resource subpackage; all resource files allocated to the currently newly added second resource subpackage are written to the currently newly added second resource subpackage.

[0010] In some embodiments, generating an upgrade directory table based on the adjusted reference directory table and the second resource subpackage includes: generating second directory items for all resource files in the second resource subpackage; and writing the second directory items to the adjusted reference directory table to generate an upgrade directory table.

[0011] To achieve the above-mentioned purpose, the second aspect of an embodiment of the present application proposes a file update method, including: constructing an update request; sending the update request to receive an upgrade catalog table and a second resource subpackage, wherein the upgrade catalog table and the second resource subpackage are both determined by the above-mentioned file packaging method.

[0012] To achieve the above-mentioned purpose, the third aspect of the embodiment of the present application proposes a file packaging device, including: an acquisition module, used to acquire a reference package system and multiple upgraded resource files, wherein the reference package system includes a reference directory table and multiple first resource sub-packages for storing original resource files, and the reference directory table is used to associate each of the original resource files; a first processing module, used to determine the changed files in the original resource files and the upgraded resource files based on the reference package system and the upgraded resource files, and adjust the reference directory table based on the changed files; a second processing module, used to determine each of the first resource sub-packages based on the adjusted reference directory table The invalid data size of a resource subpackage, wherein the invalid data size is negatively correlated with the sum of the data sizes of all the original resource files associated with the reference directory table in the first resource subpackage; a repackaging module, for repackaging the first resource subpackage based on the change file to obtain a second resource subpackage for each of the first resource subpackages when the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold; a sending module, for generating an upgrade directory table based on the adjusted reference directory table and the second resource subpackage, and sending the upgrade directory table and the second resource subpackage when an update request is received.

[0013] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned file packaging method or the above-mentioned file updating method when executing the computer program.

[0014] To achieve the above-mentioned purpose, the fifth aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium, and the storage medium stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned file packaging method, or implements the above-mentioned file updating method.

[0015] The embodiment of the present application includes at least the following beneficial effects: by referring to the package system and the upgraded resource file, the changed file is determined in the original resource file and the upgraded resource file, and then the reference directory table is adjusted based on the changed file. Since the adjusted reference directory table can indicate the data status of the first resource subpackage after the update, the invalid data size of each first resource subpackage can be accurately determined through the adjusted reference directory table. Only when the invalid data size of the first resource subpackage is greater than or equal to the repackaging threshold, the first resource subpackage is repackaged based on the changed file to obtain the second resource subpackage, which is equivalent to repackaging only the first resource subpackage with too much invalid data. Specifically, By setting an appropriate repackaging threshold, the update frequency and data redundancy of resource subpackages can be balanced, and the resource subpackages can be effectively controlled not to be repacked when small changes occur, so as to concentrate the changes of resource files in a small number of resource subpackages without triggering the update of a large number of resource subpackages. Usually, all the first resource subpackages that have changed are not repackaged, which effectively reduces the time spent on repackaging and avoids excessive data redundancy. Then, an upgrade catalog table is generated, and when an update request is received, the upgrade catalog table and the second resource subpackage are sent. Users do not need to download the entire new version of the resource package, which can effectively reduce the amount of downloaded data and save network resources, significantly enhancing the user experience.

[0016] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings are used to provide further understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.

[0018] Figure 1 A schematic diagram of an optional implementation environment provided for an embodiment of the present disclosure;

[0019] Figure 2 A schematic diagram of an optional flow chart of a file packaging method provided in an embodiment of the present disclosure;

[0020] Figure 3 An optional structural diagram of a file package system provided in an embodiment of the present application;

[0021] Figure 4 An optional specific flow chart of adjusting the reference catalog table provided in an embodiment of the present application;

[0022] Figure 5A schematic diagram of an optional process for determining the size of invalid data provided in an embodiment of the present application;

[0023] Figure 6 A schematic diagram of an optional process for determining a second resource subpackaging provided in an embodiment of the present application;

[0024] Figure 7 A schematic diagram of another optional flow chart for determining second resource subpackaging provided in an embodiment of the present application;

[0025] Figure 8 A schematic diagram of an optional process for generating an upgrade catalog table provided in an embodiment of the present application;

[0026] Fig. 9 A schematic diagram of an optional architecture of a file packaging method provided in an embodiment of the present disclosure;

[0027] Fig.10 A schematic diagram of an optional flow chart of a file updating method provided in an embodiment of the present disclosure;

[0028] Fig.11 A schematic diagram of an optional structure of a file packaging device provided in an embodiment of the present application;

[0029] Fig.12 A schematic diagram of an optional hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0031] It should be noted that in each specific embodiment of the present application, when it comes to the need to perform relevant processing based on data related to the characteristics of the target object such as target object attribute information or attribute information set, the permission or consent of the target object will be obtained first, and the collection, use and processing of these data will comply with relevant laws, regulations and standards. Among them, the target object can be a user. In addition, when the embodiment of the present application needs to obtain the target object attribute information, the target object's separate permission or separate consent will be obtained by means of a pop-up window or jumping to a confirmation page, etc., and after the separate permission or separate consent of the target object is clearly obtained, the necessary target object-related data for enabling the normal operation of the embodiment of the present application will be obtained.

[0032] In the description of this application, “several” means one or more, “more” means more than two, “greater than”, “less than”, “exceed”, etc. are understood to exclude the number, and “above”, “below”, “within”, etc. are understood to include the number.

[0033] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims or the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0034] To facilitate understanding of the technical solutions provided in the embodiments of the present application, some key terms used in the embodiments of the present application are explained here:

[0035] MD5: A hash algorithm commonly used for file data information summary. By comparing the MD5 values ​​of files, it is possible to determine whether the file contents are the same.

[0036] LZ4: A lossless compression and decompression algorithm.

[0037] In the process of computer software development and maintenance, version updates are common operations, especially in game software, where version updates are very frequent. In order to effectively manage resource files, it is usually necessary to package and merge multiple resource files into a larger resource package. Currently, when the software version is updated, every time the resource files in the resource package change, the resource package needs to be repackaged. This method is not only time-consuming, but also requires users to download the entire new version of the resource package for replacement, resulting in a large amount of downloaded data, which will significantly increase the download time, resulting in low update efficiency and affecting user experience.

[0038] Based on this, the embodiments of the present disclosure provide a file packaging method, a file updating method, an apparatus, a device and a storage medium, which can reduce time consumption and thus improve update efficiency.

[0039] Reference Figure 1 , Figure 1 A schematic diagram of an optional implementation environment provided for an embodiment of the present disclosure, the implementation environment includes a terminal 101 and a server 102, wherein the terminal 101 and the server 102 are connected via a communication network.

[0040] Exemplarily, the server 102 can obtain a reference package system and multiple upgraded resource files, wherein the reference package system includes a reference directory table and multiple first resource subpackages for storing original resource files, and the reference directory table is used to associate each original resource file; based on the reference package system and the upgraded resource files, the change files are determined in the original resource files and the upgraded resource files, and the reference directory table is adjusted based on the change files; based on the adjusted reference directory table, the invalid data size of each first resource subpackage is determined, wherein the invalid data size is negatively correlated with the sum of the data sizes of all original resource files associated with the reference directory table in the first resource subpackage; for each first resource subpackage, when the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, the first resource subpackage is repackaged based on the change file to obtain a second resource subpackage; based on the adjusted reference directory table and the second resource subpackage, an upgrade directory table is generated, and when an update request sent by the terminal 101 is received, the upgrade directory table and the second resource subpackage are sent to the terminal 101.

[0041] The server 102 determines the changed files in the original resource files and the upgraded resource files by referring to the package system and the upgraded resource files, and then adjusts the reference directory table based on the changed files. Since the adjusted reference directory table can indicate the data status of the first resource subpackage after the update, the invalid data size of each first resource subpackage can be accurately determined through the adjusted reference directory table. Only when the invalid data size of the first resource subpackage is greater than or equal to the repackaging threshold, the first resource subpackage will be repackaged based on the changed files to obtain the second resource subpackage, which is equivalent to repackaging only the first resource subpackage with too much invalid data. Specifically, by setting the appropriate The repackaging threshold can balance the update frequency and data redundancy of resource subpackages, and effectively control the resource subpackages not to be repackaged when small changes occur, so as to concentrate the changes of resource files into a small number of resource subpackages without triggering the update of a large number of resource subpackages. Usually, all the first resource subpackages that have changed are not repackaged, which effectively reduces the time consumption of repackaging and avoids excessive data redundancy. Then, an upgrade catalog table is generated, and when an update request is received, the upgrade catalog table and the second resource subpackage are sent. Users do not need to download the entire new version of the resource package, which can effectively reduce the amount of downloaded data and save network resources, significantly enhancing the user experience.

[0042] Server 102 can be an independent physical server, or 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 communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. In addition, server 102 can also be a node server in a blockchain network.

[0043] The terminal 101 may be a mobile phone, a computer, an intelligent voice interaction device, an intelligent home appliance, a vehicle-mounted terminal, etc., but is not limited thereto. The terminal 101 and the server 102 may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present disclosure.

[0044] Reference Figure 2 , Figure 2 An optional flow chart of a file packaging method provided in an embodiment of the present disclosure, the file packaging method can be executed by a server, or can also be executed by a terminal, or can also be executed by a server in cooperation with a terminal, the file packaging method includes but is not limited to the following steps 201 to 205.

[0045] Step 201, obtaining a reference package system and a plurality of upgrade resource files.

[0046] The reference package system includes a reference directory table and a plurality of first resource sub-packages for storing original resource files, and the reference directory table is used to associate various original resource files.

[0047] Specifically, the reference package system belongs to the file package system. An independent file package system is usually composed of a directory table and several resource subpackages. Any resource subpackage is packaged by several resource files. The directory table is a structure used to organize resource files in the file package system. The directory table includes directory entries of each resource file. Each independent file package system is configured with a package name, which corresponds to the file name of the file package system on the storage medium.

[0048] Then, the directory table in the file package system may exist in the form of a file. For example, the directory table may have a fixed file suffix .idx. Assuming the package name is abc, the file name of the directory table in the file package system on the storage medium is abc.idx.

[0049] Then, each resource subpackage file can have a number, which can correspond to the subpackage index number in the directory item and be reflected in the file name suffix of the subpackage file. For example, assuming the package name is abc, and the number of a resource subpackage is 1, the file name corresponding to the resource subpackage on the storage medium is abc.1.

[0050] For example, refer to Figure 3 , Figure 3 An optional structural diagram of a file package system provided for an embodiment of the present application, wherein the file package system includes a directory table file and multiple resource subpackages, each resource subpackage may include several resource files, the directory table file may include several directory items, each directory item may have an associated resource file, the directory item may represent the type of the resource file, when a resource file in a resource subpackage has an associated directory item, the resource file is a valid file, and when a resource file in a resource subpackage does not have an associated directory item, the resource file is an invalid file.

[0051] It can be understood that the reference directory table belongs to the directory table in the file package system, the first resource subpackage belongs to the resource subpackage in the file package system, the reference directory table is used to associate various original resource files, and the reference directory table contains the index of all original resource files in the reference package system. For example, the first directory item in the reference directory table may include the subpackage index number, subpackage data offset, data size and checksum value of the original resource file.

[0052] It should be noted that the original resource file is the resource file of the original version. When the version is updated, the original resource file can be deleted or modified, or a new resource file can be added to obtain an upgraded version of the upgraded resource file. It can be seen that the upgraded resource file can include the original resource file that has not been deleted or modified, the modified resource file and the newly added resource file. Updating the resource file is equivalent to updating the file package system.

[0053] It is worth noting that the initial version of the package system usually does not need to be generated using the reference package system, that is, the reference package system does not need to be used for the first packaging, and the initial version of the package system can be obtained by directly packaging the initial version of the resource files. However, the initial version of the package system can also be regarded as being obtained by version update based on the reference package system. At this time, during the version update process, the reference package system does not contain resource sub-packaging and the directory table does not contain directory items. All resource files of the initial version are newly added resource files. When the version is updated again later, the package system obtained from the previous version update can be used as the reference package system. This has the best effect for normal clients that perform version updates in a timely manner every time, and can effectively reduce the amount of downloaded data.

[0054] Step 202, based on the reference package system and the upgraded resource files, determine the changed files in the original resource files and the upgraded resource files, and adjust the reference directory table based on the changed files.

[0055] It can be understood that by referring to the package system and the upgraded resource files, the changed files can be identified in the original resource files and the upgraded resource files. The changed files can specifically be resource files other than the original resource files that have not been deleted or modified. The reference directory table is adjusted based on the changed files so that the adjusted reference directory table can effectively indicate the data status of the first resource subpackage after the update.

[0056] Step 203: determine the invalid data size of each first resource subpacket based on the adjusted reference directory table.

[0057] The invalid data size is negatively correlated with the total data size of all original resource files associated with the reference directory table in the first resource subpackage.

[0058] It can be understood that, since the adjusted reference directory table can indicate the data status of the first resource subpackage after the update, the invalid data size of each first resource subpackage can be accurately determined through the adjusted reference directory table. Specifically, for each first resource subpackage, the larger the sum of the data sizes of all the original resource files associated with the reference directory table in the first resource subpackage, the larger the valid data size in the first resource subpackage is, and correspondingly, the smaller the invalid data size of the first resource subpackage is; and the smaller the sum of the data sizes of all the original resource files associated with the reference directory table in the first resource subpackage is, the smaller the valid data size in the first resource subpackage is, and correspondingly, the larger the invalid data size of the first resource subpackage is.

[0059] It should be noted that, for each first resource subpackage, when the original resource file in the first resource subpackage is associated with the reference directory table before the reference directory table is adjusted, and the original resource file is not associated with the reference directory table after the reference directory table is adjusted, the original resource file can be regarded as newly generated redundant data in the first resource subpackage. The generation of new redundant data in the first resource subpackage will increase the invalid data size of the first resource subpackage.

[0060] Step 204 : for each first resource subpackage, when the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, the first resource subpackage is repacked based on the changed file to obtain a second resource subpackage.

[0061] It should be noted that when the invalid data size of the first resource subpackage is less than the repackaging threshold, it means that the redundant data of the first resource subpackage is small, and there is no need to repack the first resource subpackage. Only when the invalid data size of the first resource subpackage is greater than or equal to the repackaging threshold, it means that the redundant data of the first resource subpackage is large, and the first resource subpackage needs to be repacked to obtain the second resource subpackage. Repackaging is essentially a subpackaging of resource files. Repackaging makes the second resource subpackage have no redundant data in the current update round, that is, the resource files contained in the second resource subpackage are all upgraded resource files, which effectively avoids excessive redundant data in the resource subpackage. Therefore, the repackaging threshold should not be set too small to avoid frequent triggering of updates of the first resource subpackage, and the repackaging threshold should not be set too large to avoid excessive redundant data in the first resource subpackage.

[0062] Specifically, the repackaging threshold can be set directly. For example, relevant personnel can directly set a suitable repackaging threshold based on multiple experimental results, or determine a suitable repackaging threshold based on the automatic analysis results of historical data. The repackaging threshold can also be set indirectly. For example, a ratio threshold that triggers repackaging is first set, and then the repackaging threshold is determined by multiplying the data size of the first resource package by the ratio threshold.

[0063] Step 205: Generate an upgraded catalog table based on the adjusted reference catalog table and the second resource sub-package, and send the upgraded catalog table and the second resource sub-package when an update request is received.

[0064] Among them, the upgrade directory table belongs to the directory table in the file package system. The upgrade directory table is used to associate various upgrade resource files. The upgrade directory table contains the indexes of all upgrade resource files. For example, the upgrade directory table may contain the subpackage index number, subpackage data offset and data size of the upgrade resource file. Since the resource files in the second resource subpackage are all upgrade resource files, the second resource subpackage needs to be sent when an update request is received.

[0065] Furthermore, since the adjusted reference directory table can effectively indicate the data status of the first resource subpackage after the update, and the second resource subpackage can indicate the data status after the re-subpackage, for the first resource subpackage that has not been repackaged, if the original resource file in the first resource subpackage is not deleted or modified during the update process, the original resource file will still belong to the upgraded resource file after the upgrade. The upgraded directory table generated by the adjusted reference directory table and the second resource subpackage can determine whether the original resource file belongs to the upgraded resource file, so it is also necessary to send the upgraded directory table to ensure the reliability of the resource file update results.

[0066] Specifically, the upgrade catalog table and the second resource sub-package can be stored in the server, and the update request can be constructed by the terminal that needs to perform a version update. The server communicates with the terminal. When the server receives the update request sent by the terminal, the server will send the upgrade catalog table and the second resource sub-package to the terminal, so that the terminal can perform a version update based on the upgrade catalog table and the second resource sub-package.

[0067] Based on this, by referring to the package system and the upgraded resource file, the changed file is determined in the original resource file and the upgraded resource file, and then the reference directory table is adjusted based on the changed file. Since the adjusted reference directory table can indicate the data status of the first resource subpackage after the update, the invalid data size of each first resource subpackage can be accurately determined through the adjusted reference directory table. Only when the invalid data size of the first resource subpackage is greater than or equal to the repackaging threshold, the first resource subpackage will be repackaged based on the changed file to obtain the second resource subpackage, which is equivalent to repackaging only the first resource subpackage with too much invalid data. Specifically, by setting the appropriate The repackaging threshold can balance the update frequency and data redundancy of resource subpackages, and effectively control the resource subpackages not to be repackaged when small changes occur, so as to concentrate the changes of resource files into a small number of resource subpackages without triggering the update of a large number of resource subpackages. Usually, all the first resource subpackages that have changed are not repackaged, which effectively reduces the time of repackaging and avoids excessive data redundancy. Then, an upgrade catalog table is generated, and when an update request is received, the upgrade catalog table and the second resource subpackage are sent. Users do not need to download the entire new version of the resource package, which can effectively reduce the amount of downloaded data and save network resources, significantly enhancing the user experience.

[0068] It should be noted that when a new version of a file is updated, the file packaging method provided in this application will automatically optimize the sub-packaging and packaging according to the changes in the new version of the file, so that users can download the updated content at a relatively low cost without occupying a large amount of network resources, especially in an environment with limited network resources or poor network conditions, which can effectively improve the user experience.

[0069] It is worth noting that for the file package system before and after the version update, you can retrieve files and read file data in the file package system according to the given resource file path. Specifically, you only need to load the directory table of the file package system in the application, read all directory items to build a retrieval table, and the retrieval table structure can use hash tables, balanced binary trees and other data structures that support fast retrieval. Then, based on the retrieval table, you can locate the corresponding directory item according to the given resource file path, and then load the corresponding resource file data from the corresponding resource subpackage according to the subpackage index number, subpackage data offset, and file data size recorded in the directory item.

[0070] It should be noted that for the file package system before and after the version update, data encryption and compression support can be introduced. For example, the data block of the resource subpackage can be encrypted through algorithms such as pseudo-random number XOR encryption, and then decrypted through the corresponding inverse operation when reading the data block of the resource subpackage. In terms of compression support, the data block corresponding to each resource file in the resource subpackage can be compressed using a lossless compression algorithm, for example, using the LZ4 compression algorithm.

[0071] In addition, refer to Figure 4 In one embodiment, the reference directory table includes the first directory item of each original resource file, the first directory item includes the path and check value corresponding to the original resource file, the changed file includes the newly added file, the deleted file, the file to be changed and the modified file, based on the reference package system and the upgraded resource file, the changed file is determined in the original resource file and the upgraded resource file, and the reference directory table is adjusted based on the changed file, including but not limited to the following steps 401 to 405:

[0072] Step 401, comparing the path corresponding to the original resource file and the path corresponding to the upgraded resource file to obtain a first comparison result;

[0073] Step 402, comparing the check value corresponding to the original resource file and the check value corresponding to the upgraded resource file to obtain a second comparison result;

[0074] Step 403, based on the first comparison result, determining deleted files in each original resource file, and determining newly added files in each upgraded resource file;

[0075] Step 404, based on the first comparison result and the second comparison result, determine the files to be modified in each original resource file, and determine the modified files corresponding to the files to be modified in each upgraded resource file;

[0076] Step 405: In the reference directory table, remove the first directory entries corresponding to the deleted file and the file to be modified.

[0077] Among them, the path between the deleted file and any upgraded resource file is different, the path between the newly added file and any original resource file is different, and the path between the file to be modified and the corresponding modified file is the same and the check value is different.

[0078] Specifically, the check value can be determined by check algorithms such as MD5 algorithm, SHA1, CRC, etc. For example, the MD5 algorithm is called to map the original resource file to obtain the check value corresponding to the original resource file, and the MD5 algorithm is called to map the upgraded resource file to obtain the check value corresponding to the upgraded resource file.

[0079] Specifically, the path corresponding to the original resource file may be a combination of the original logical path and the original physical path, for example, the original logical path may be the subpackage index number and the subpackage data offset of the original resource file, and the original physical path may be the storage path of the original resource subpackage where the original resource file is located; the path corresponding to the upgraded resource file may be a combination of the upgraded logical path and the upgraded physical path, for example, the upgraded logical path may be the subpackage index number and the subpackage data offset of the upgraded resource file, and the upgraded physical path may be the storage path of the upgraded resource subpackage where the upgraded resource file is located;

[0080] It should be noted that during the update process, resource files may be added, deleted, and modified in at least one of the following situations. When a resource file is added, the newly added file can be determined in each upgraded resource file. When a resource file is deleted, the deleted file can be determined in each original resource file. When a resource file is modified, the file to be modified can be determined in each original resource file, as well as the modified file corresponding to the file to be modified in each upgraded resource file.

[0081] Based on this, the first directory item is compared with the upgraded resource file. Specifically, it is necessary to compare the path corresponding to the original resource file and the path corresponding to the upgraded resource file, and it is necessary to compare the check value corresponding to the original resource file and the check value corresponding to the upgraded resource file. Then, based on the first comparison result obtained by the comparison, the deleted files and the newly added files are determined, and based on the first comparison result and the second comparison result obtained by the comparison, the files to be modified and the modified files are determined. The changed files can be accurately determined in the original resource file and the upgraded resource file. Then, in the reference directory table, the first directory items corresponding to the deleted files and the files to be modified are eliminated, and the reference directory table can be accurately adjusted so that the adjusted reference directory table can effectively indicate the data status of the first resource subpackage after the update.

[0082] In addition, refer to Figure 5 In one embodiment, the first directory entry includes the data size corresponding to the original resource file, and determining the invalid data size of each first resource sub-packet based on the adjusted reference directory table includes but is not limited to the following steps 501 to 502:

[0083] Step 501, based on the first directory entry, determining the effective data size of each first resource subpacket;

[0084] Step 502: for each first resource subpackage, when the file size of the first resource subpackage is less than or equal to a preset subpackage threshold, the difference between the subpackage threshold and the valid data size is determined as the invalid data size of the first resource subpackage; or, when the file size of the first resource subpackage is greater than the subpackage threshold, the difference between the file size of the first resource subpackage and the valid data size is determined as the invalid data size of the first resource subpackage.

[0085] Among them, the effective data size is the sum of the data sizes of all original resource files associated with the reference directory table in the first resource subpackage. The original resource files associated with the reference directory table refer to files for which corresponding first directory entries exist. Therefore, the original resource files associated with the reference directory table can be used as valid files in the first resource subpackage.

[0086] Specifically, the subpackaging threshold refers to the capacity limit value of the resource subpackaging during subpackaging, that is, the subpackaging threshold is used to limit the data size of the resource subpackaging. A loose principle is adopted during subpackaging, that is, the data size of the resource subpackaging is not strictly prohibited from exceeding the subpackaging threshold. Instead, as long as the data size of the resource subpackaging is greater than or equal to the subpackaging threshold, no resource file will be written to the resource subpackaging.

[0087] It is worth noting that setting an appropriate subpackaging threshold can improve the reliability of version updates. The setting of the subpackaging threshold usually takes into account the amount of data downloaded when a resource file is updated. Specifically, when a version update occurs in the file package system, the file data is downloaded and updated in subpackaging units. The maximum size of each resource subpackaging is controlled to control the minimum data download amount when a version update occurs. Because the entire resource subpackaging needs to be downloaded during the update, the subpackaging threshold should not be set too large. Secondly, the number of resource subpackaging should not be too large, otherwise the meaning of file subpackaging is lost. Therefore, the subpackaging threshold should not be set too small.

[0088] Based on this, since the first directory item contains the data size of the original resource file associated with the reference directory table, the sum of the data sizes of all the original resource files associated with the reference directory table in the first resource subpackage can be determined based on the first directory item, that is, the valid data size of each first resource subpackage can be determined. Then, for each first resource subpackage, the invalid data size of the first resource subpackage can be determined in two cases. In the first case, when the file size of the first resource subpackage is less than or equal to the subpackage threshold, it means that the first resource subpackage is not full, that is, the first resource subpackage can also write new resource files. For example, when subpackages are performed on resource files, since the last resource subpackage is usually only allocated to a small number of resource files, the last resource subpackage is usually not full, that is, the resource subpackage has remaining write capacity. The remaining write capacity of the resource subpackage and other data in the resource subpackage except the valid files can be regarded as invalid data. At this time, the difference between the subpackage threshold and the valid data size is determined as the invalid data size of the first resource subpackage to ensure the reliability of the invalid data size.

[0089] In the second case, when the file size of the first resource subpackage is greater than the subpackage threshold, it means that the first resource subpackage is full, that is, no new resource file can be written to the first resource subpackage, and all other data in the resource subpackage except the valid file can be regarded as invalid data. At this time, the difference between the file size of the first resource subpackage and the valid data size is determined as the invalid data size of the first resource subpackage, which can also ensure the reliability of the invalid data size.

[0090] In one possible implementation, when the data size of a resource subpackage approaches a subpackage threshold, resource files are no longer written to the resource subpackage. For example, when the difference between the subpackage threshold and the data size of the resource subpackage is less than a preset stop threshold, the data size of the resource subpackage is considered to be close to the subpackage threshold.

[0091] In addition, in one embodiment, based on the reference package system and the upgraded resource file, after the changed files are determined in the original resource file and the upgraded resource file, the file packaging method further includes but is not limited to the following steps:

[0092] Register new and modified files to the preset update pool;

[0093] Then, refer to Figure 6 In one embodiment, when the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, the first resource subpackage is repacked based on the changed file to obtain a second resource subpackage, including but not limited to the following steps 601 to 603:

[0094] Step 601, when the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, register the valid files in the first resource subpackage into the update pool, and remove the first directory entry corresponding to the valid files;

[0095] Step 602: Allocate unallocated resource files in the update pool to the first resource subpackage until there are no unallocated resource files in the update pool, or until the sum of the data sizes of all resource files allocated to the first resource subpackage is greater than or equal to a preset subpackage threshold;

[0096] Step 603: remove all files in the first resource subpackage, write all resource files allocated to the first resource subpackage into the first resource subpackage, and obtain a second resource subpackage.

[0097] Among them, the valid file is the original resource file that has a corresponding first directory entry.

[0098] Specifically, the update pool can be a temporarily created storage space, which can be used to record resource files that need to be written into resource subpackages but have not yet been allocated to resource subpackages. Normally, in order to save resources, only the path and data size of the resource file can be recorded in the update pool. At this time, when the resource file is updated, the resource file can be repackaged into other resource subpackages by modifying the corresponding directory entry in the directory table without changing the subpackage where the old version of the resource file is located.

[0099] It is worth noting that, in special cases, all data of the resource file may also be recorded in the update pool, which is not limited in the embodiments of the present disclosure.

[0100] Based on this, when the invalid data size of the first resource subpackage is greater than or equal to the preset repackaging threshold, it is considered that the first resource subpackage triggers repackaging. For the first resource subpackage that triggers repackaging, it is necessary to traverse all the first directory items and register all the valid files that exist in the first resource subpackage and the corresponding first directory items in the first resource subpackage into the update pool. Since the reference directory table has been adjusted based on the changed files, the valid files registered in the update pool are all original resource files that have not been deleted or modified during the version update, which is equivalent to that the resource files registered in the update pool are all upgraded resource files. Then, the first directory items corresponding to the registered valid files are removed. At this time, all the resource files in the first resource subpackage do not have corresponding first directory items, and all the resource files in the first resource subpackage are invalid data. Then, the resource files in the update pool are reallocated to the first resource subpackage. For example, several resource files are taken from the file list registered in the update pool and allocated to the first resource subpackage until the preset allocation condition is met. The allocation condition may be that there are no unallocated resource files in the update pool. At this time, no new resource files can be allocated to the first resource subpackage. The allocation condition may also be that the sum of the data sizes of all resource files allocated to the first resource subpackage is greater than or equal to the subpackage threshold. At this time, no resource files are allocated to the first resource subpackage, which can avoid the second resource subpackage from being too large. Then, the entries of the allocated resource files can be removed from the update pool. Then, after the allocation is completed, the content in the first resource subpackage that triggers the repackaging is cleared, the resource file data allocated to the first resource subpackage is read in sequence, and then the resource files are written to the first resource subpackage to obtain the second resource subpackage. This can improve the accuracy of the second resource subpackage and ensure that the second resource subpackage only has upgraded resource files without redundant data.

[0101] It should be noted that when determining the second resource subpackage, the verification value of the upgraded resource file in the second resource subpackage can be calculated simultaneously, and the file index number, subpackage data offset and data size of the upgraded resource file in the second resource subpackage can be determined, thereby generating a directory entry for the upgraded resource file.

[0102] It is worth noting that during the allocation process, resource files can be randomly selected from the update pool for allocation, or they can be allocated in sequence according to the update frequency of the resource files from high to low, so that the update frequency of the resource files in the same second resource sub-package is similar. Subsequently, usually only the resource sub-package with a higher overall update frequency needs to be downloaded, thereby reducing the amount of downloaded data during the update. For each changed file, only the modified file needs to determine the update frequency, which can be determined based on historical update data, and the update frequency of the newly added file can be set to 0.

[0103] In a possible implementation, after determining the invalid data size of each first resource subpackage based on the adjusted reference directory table, the file packaging method further includes: when the invalid data size of the first resource subpackage is less than the repackaging threshold, copying the first resource subpackage, and using the copied first resource subpackage as the resource subpackage after the version update. Based on this, when the invalid data size of the first resource subpackage is less than the repackaging threshold, it is considered that the first resource subpackage has not triggered repackaging. For the first resource subpackage that has not triggered repackaging, the first resource subpackage can be copied to the new version of the file package system, or the first resource subpackage can be directly moved to the new version of the file package system, so that the file package system has the first resource subpackage that has not triggered repackaging, ensuring the integrity of the resource file.

[0104] In addition, refer to Figure 7 In one embodiment, when the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, the first resource subpackage is repacked based on the changed file to obtain the second resource subpackage. The file packaging method further includes but is not limited to the following steps 701 to 702:

[0105] Step 701, when there are unallocated resource files in the update pool, the unallocated resource files in the update pool are allocated to the newly added second resource subpackage;

[0106] Step 702: write all resource files allocated to the currently added second resource subpackage into the currently added second resource subpackage.

[0107] Based on this, after repackaging all resource subpackages that trigger repackaging, if there are still unallocated resource files in the update pool, it is necessary to allocate the unallocated resource files in the update pool to the newly added second resource subpackage. The number of the newly added second resource subpackage is an unused number in the current file package system, for example, the currently used maximum encoding + 1, and then the allocated resource files are written to the currently newly added second resource subpackage to ensure that the upgraded resource files in the update pool can be written into the corresponding resource subpackages, ensuring the integrity of the upgrade data, thereby improving the reliability of version updates.

[0108] It is worth noting that, under the restriction of the sub-package threshold, when one newly added second resource sub-package cannot satisfy the allocation of all remaining resource files in the update pool, more second resource sub-packages may be added.

[0109] In addition, refer to Figure 8 In one embodiment, the upgrade catalog table is generated based on the adjusted reference catalog table and the second resource sub-package, including but not limited to the following steps 801 to 802:

[0110] Step 801, generating a second directory entry of all resource files in the second resource subpackage;

[0111] Step 802, writing the second directory entry into the adjusted reference directory table to generate an upgraded directory table.

[0112] Based on this, since the resource files in the second resource subpackage are resource files in the update pool, each resource file in the second resource subpackage is an upgraded resource file. The second directory item may include the subpackage index number, subpackage data offset, data size and check value that may contain the upgraded resource files. Writing the second directory item to the adjusted reference directory table can generate a complete directory table for the upgraded resource files, that is, generate an upgraded directory table, thereby improving the accuracy of the upgraded directory table. After the upgrade target table is generated, the entire incremental packaging process can be regarded as completed.

[0113] The complete process of the file packaging method is described in detail below.

[0114] Reference Fig. 9 , Fig. 9 A schematic diagram of an optional architecture of the file packaging method provided in the embodiment of the present disclosure.

[0115] First, the server obtains a reference package system and a plurality of upgraded resource files, wherein the reference package system includes a reference directory table and a plurality of first resource sub-packages for storing original resource files, and the reference directory table is used to associate various original resource files.

[0116] Then, the server compares the path corresponding to the original resource file and the path corresponding to the upgraded resource file to obtain a first comparison result; compares the check value corresponding to the original resource file and the check value corresponding to the upgraded resource file to obtain a second comparison result, thereby realizing the loading of the directory table from the reference package system and then performing comparison through the directory table.

[0117] Then, based on the first comparison result, the server determines the deleted files in each original resource file, and determines the newly added files in each upgraded resource file, wherein the paths between the deleted files and any upgraded resource file are different, and the paths between the newly added files and any original resource file are different. Based on the first comparison result and the second comparison result, the server determines the files to be modified in each original resource file, and determines the modified files corresponding to the files to be modified in each upgraded resource file, wherein the paths between the files to be modified and the corresponding modified files are the same and the check values ​​are different. Comparison of changed files is achieved.

[0118] Then, the server removes the first directory entries corresponding to the deleted files and the files to be modified from the reference directory table, which is equivalent to updating the directory table; and registers the newly added files and the modified files into the preset update pool.

[0119] Then, the server determines the effective data size of each first resource subpacket based on the first directory item, wherein the effective data size is the sum of the data sizes of all original resource files associated with the reference directory table in the first resource subpacket, and the original resource files associated with the reference directory table are files for which corresponding first directory items exist.

[0120] Then, for each first resource subpackaging, when the file size of the first resource subpackaging is less than or equal to the preset subpackaging threshold, the server determines the difference between the subpackaging threshold and the valid data size as the invalid data size of the first resource subpackaging; or, when the file size of the first resource subpackaging is greater than the subpackaging threshold, the server determines the difference between the file size of the first resource subpackaging and the valid data size as the invalid data size of the first resource subpackaging.

[0121] Then, the server determines whether each first resource subpackage needs to be repackaged by judging the repackaging threshold. Specifically, when the invalid data size of the first resource subpackage is smaller than the repackaging threshold, the subpackage can be directly copied; and when the invalid data size of the first resource subpackage is greater than or equal to the preset repackaging threshold, the valid files in the first resource subpackage are registered in the update pool, which is equivalent to breaking them up into the update pool and removing the first directory entries corresponding to the valid files, wherein the valid files are the original resource files for which the corresponding first directory entries exist.

[0122] Then, the server allocates the unallocated resource files in the update pool to the first resource subpackage until there are no unallocated resource files in the update pool, or until the sum of the data sizes of all resource files allocated to the first resource subpackage is greater than or equal to a preset subpackage threshold; all files in the first resource subpackage are eliminated, and all resource files allocated to the first resource subpackage are written to the first resource subpackage to obtain a second resource subpackage.

[0123] Then, the server determines whether there are unallocated resource files in the update pool. If there are unallocated resource files in the update pool, the unallocated resource files in the update pool are allocated to the newly added second resource subpackage; all resource files allocated to the currently newly added second resource subpackage are written to the currently newly added second resource subpackage.

[0124] Then, the server generates a second directory entry for all resource files in the second resource subpackage; writes the second directory entry into the adjusted reference directory table to generate an upgraded directory table; when the server receives an update request sent by the terminal, it sends the upgraded directory table and the second resource subpackage to the terminal.

[0125] Based on this, by referring to the package system and the upgraded resource file, the changed file is determined in the original resource file and the upgraded resource file, and then the reference directory table is adjusted based on the changed file. Since the adjusted reference directory table can indicate the data status of the first resource subpackage after the update, the invalid data size of each first resource subpackage can be accurately determined through the adjusted reference directory table. Only when the invalid data size of the first resource subpackage is greater than or equal to the repackaging threshold, the first resource subpackage will be repackaged based on the changed file to obtain the second resource subpackage, which is equivalent to repackaging only the first resource subpackage with too much invalid data. Specifically, by setting the appropriate The repackaging threshold can balance the update frequency and data redundancy of resource subpackages, and effectively control the resource subpackages not to be repackaged when small changes occur, so as to concentrate the changes of resource files into a small number of resource subpackages without triggering the update of a large number of resource subpackages. Usually, all the first resource subpackages that have changed are not repackaged, which effectively reduces the time of repackaging and avoids excessive data redundancy. Then, an upgrade catalog table is generated, and when an update request is received, the upgrade catalog table and the second resource subpackage are sent. Users do not need to download the entire new version of the resource package, which can effectively reduce the amount of downloaded data and save network resources, significantly enhancing the user experience.

[0126] Reference Fig.10 , Fig.10 An optional flow chart of a file update method provided for an embodiment of the present disclosure, the file packaging method can be executed by a server, or can also be executed by a terminal, or can also be executed by a server in cooperation with a terminal, the file update method includes but is not limited to the following steps 1001 to 1002.

[0127] Step 1001, construct an update request;

[0128] Step 1002: Send an update request to receive an upgrade catalog table and a second resource package.

[0129] The upgrade catalog table and the second resource sub-package are both determined by the above-mentioned file packaging method.

[0130] It can be understood that the specific implementation of the file updating method is basically the same as the specific implementation of the above-mentioned file packaging method, and will not be repeated here.

[0131] In a possible implementation, constructing an update request can specifically be to obtain a checklist file, wherein the checklist file includes a check value of the upgrade directory table and a check value of the second resource subpackage; determine the check value of the directory table in the local package system stored locally, and determine the check value of the resource subpackage in the local package system; when the check value of the upgrade directory table is different from the check value of the directory table in the local package system, and the check value of the second resource subpackage is different from the check value of the resource subpackage in the local package system, construct an update request. Based on this, the check value can use an MD5 value, without the need for complex file package version management and incremental update package settings, which can reduce the complexity of version updates, eliminate the need to care about the details of incremental update packaging, and reduce the burden on the loading and reading ends.

[0132] It should be noted that the verification value of the second resource subpackage is different from the verification value of the resource subpackage in the local package system, which can be divided into two situations. The first situation is that the local package system has a resource subpackage corresponding to the second resource subpackage, but the verification value of the second resource subpackage is different from the verification value of the resource subpackage in the local package system; the second situation is that the local package system does not have a resource subpackage corresponding to the second resource subpackage.

[0133] In one possible implementation, the update request may also include a first request and a second request. When the verification value of the upgrade catalog table is different from the verification value of the catalog table in the local package system, the first request is constructed and the upgrade catalog table is received by sending the first request. When the verification value of the second resource subpackage is different from the verification value of the resource subpackage, a second request is constructed and the second resource subpackage is received by sending the second request.

[0134] It should be noted that the resource subpackage in the local package system may not only be different from the second resource subpackage, but also may be different from the first resource subpackage in the upgraded version whose data has not changed. In this case, it is also necessary to determine whether the verification value of the resource subpackage in the local package system is the same as the verification value of the first resource subpackage in the upgraded version whose data has not changed. If they are different, the corresponding first resource subpackage needs to be downloaded. For example, during the version update process, the first resource subpackage abc.1 in the reference package system has no data change, that is, the updated file package system also contains the first resource subpackage abc.1. In this case, it is necessary to determine whether the verification value of the resource subpackage in the local package system is the same as the verification value of the first resource subpackage abc.1. If they are different, the first resource subpackage abc.1 needs to be downloaded.

[0135] In addition, refer to Fig.11 The present application also provides a file packaging device 1100, including:

[0136] The acquisition module 1101 is used to acquire a reference package system and multiple upgraded resource files, wherein the reference package system includes a reference directory table and multiple first resource sub-packages for storing original resource files, and the reference directory table is used to associate various original resource files;

[0137] The first processing module 1102 is used to determine the changed files in the original resource files and the upgraded resource files based on the reference package system and the upgraded resource files, and adjust the reference directory table based on the changed files;

[0138] The second processing module 1103 is used to determine the invalid data size of each first resource subpackage based on the adjusted reference directory table, wherein the invalid data size is negatively correlated with the total data size of all original resource files associated with the reference directory table in the first resource subpackage;

[0139] The repackaging module 1104 is used to repack each first resource subpackage based on the changed file to obtain a second resource subpackage when the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold;

[0140] The sending module 1105 is used to generate an upgraded catalog table based on the adjusted reference catalog table and the second resource sub-package, and send the upgraded catalog table and the second resource sub-package when an update request is received.

[0141] It can be understood that the specific implementation of the file packaging device 1100 is basically the same as the specific implementation of the above-mentioned file packaging method, and will not be repeated here.

[0142] In addition, refer to Fig.12 , Fig.12 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0143] The processor 1201 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0144] The memory 1202 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1202 can store an operating system and other applications. When the technical solution provided in the embodiments of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1202, and the processor 1201 calls and executes the file packaging method of the embodiment of the present application, or implements the above-mentioned file update method;

[0145] Input / output interface 1203, used to implement information input and output;

[0146] The communication interface 1204 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);

[0147] A bus 1205 that transmits information between the various components of the device (e.g., the processor 1201, the memory 1202, the input / output interface 1203, and the communication interface 1204);

[0148] The processor 1201 , the memory 1202 , the input / output interface 1203 and the communication interface 1204 are connected to each other in communication within the device via the bus 1205 .

[0149] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium used for computer-readable storage. The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned file packaging method, or to implement the above-mentioned file updating method.

[0150] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0151] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0152] It can be understood by those skilled in the art that Figures 1 to 10 The technical solutions shown in the figure do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown in the figure, or a combination of certain steps, or different steps.

[0153] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0154] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0155] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0156] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0157] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0158] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0159] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0160] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0161] The preferred embodiments of the present application are described above with reference to the accompanying drawings, but the scope of the rights of the present application is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present application should be within the scope of the rights of the present application.

Claims

1. A file packaging method, characterized in that: include: Acquire a reference package system and a plurality of upgraded resource files, wherein the reference package system comprises a reference directory table and a plurality of first resource sub-packages for storing original resource files, and the reference directory table is used to associate each of the original resource files; Based on the reference package system and the upgraded resource file, a changed file is determined in the original resource file and the upgraded resource file, and the reference directory table is adjusted based on the changed file; Determining the invalid data size of each of the first resource subpackages based on the adjusted reference directory table, wherein the invalid data size is negatively correlated with the sum of data sizes of all the original resource files associated with the reference directory table in the first resource subpackage; For each of the first resource subpackages, when the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, repackaging the first resource subpackage based on the change file to obtain a second resource subpackage; An upgrade catalog table is generated based on the adjusted reference catalog table and the second resource sub-package, and when an update request is received, the upgrade catalog table and the second resource sub-package are sent.

2. The file packaging method according to claim 1, characterized in that: The reference directory table includes a first directory item of each of the original resource files, the first directory item includes a path and a check value corresponding to the original resource file, the changed files include a newly added file, a deleted file, a file to be changed, and a modified file, the changing files are determined in the original resource files and the upgraded resource files based on the reference package system and the upgraded resource files, and the reference directory table is adjusted based on the changing files, including: Comparing the path corresponding to the original resource file and the path corresponding to the upgraded resource file to obtain a first comparison result; Comparing the check value corresponding to the original resource file and the check value corresponding to the upgraded resource file to obtain a second comparison result; Based on the first comparison result, determining the deleted file in each of the original resource files, and determining the newly added file in each of the upgraded resource files, wherein the deleted file has a different path from any of the upgraded resource files, and the newly added file has a different path from any of the original resource files; Based on the first comparison result and the second comparison result, determining the file to be modified in each of the original resource files, and determining the modified file corresponding to the file to be modified in each of the upgraded resource files, wherein the path between the file to be modified and the corresponding modified file is the same and the check value is different; In the reference directory table, the first directory entries corresponding to the deleted file and the file to be modified are deleted.

3. The file packaging method according to claim 2, characterized in that: The first directory entry includes the data size corresponding to the original resource file, and the determining the invalid data size of each of the first resource subpackets based on the adjusted reference directory table includes: Based on the first directory entry, determining the effective data size of each of the first resource subpackages, wherein the effective data size is the sum of the data sizes of all the original resource files associated with the reference directory table in the first resource subpackage, and the original resource files associated with the reference directory table refer to the files for which the corresponding first directory entry exists; For each of the first resource subpackages, when the file size of the first resource subpackage is less than or equal to a preset subpackage threshold, the difference between the subpackage threshold and the valid data size is determined as the invalid data size of the first resource subpackage; or, when the file size of the first resource subpackage is greater than the subpackage threshold, the difference between the file size of the first resource subpackage and the valid data size is determined as the invalid data size of the first resource subpackage.

4. The file packaging method according to claim 2, characterized in that: After determining the changed files in the original resource file and the upgraded resource file based on the reference package system and the upgraded resource file, the file packaging method further includes: Registering the newly added file and the modified file into a preset update pool; When the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, repackaging the first resource subpackage based on the changed file to obtain a second resource subpackage, including: When the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, registering valid files in the first resource subpackage into the update pool, and removing the first directory entry corresponding to the valid files, wherein the valid files are the original resource files corresponding to the first directory entry; Allocating unallocated resource files in the update pool to the first resource subpackage until there are no unallocated resource files in the update pool, or until the sum of data sizes of all resource files allocated to the first resource subpackage is greater than or equal to a preset subpackage threshold; All files in the first resource subpackage are removed, and all resource files allocated to the first resource subpackage are written into the first resource subpackage to obtain a second resource subpackage.

5. The file packaging method according to claim 4, characterized in that: When the invalid data size of the first resource subpackage is greater than or equal to a preset repackaging threshold, the first resource subpackage is repacked based on the changed file to obtain a second resource subpackage, the file packaging method further includes: When there are unallocated resource files in the update pool, the unallocated resource files in the update pool are allocated to the newly added second resource subpackage; All resource files allocated to the currently added second resource subpackage are written to the currently added second resource subpackage.

6. The file packaging method according to claim 4, characterized in that: The step of generating an upgrade catalog table based on the adjusted reference catalog table and the second resource sub-packaging includes: Generate a second directory entry for all resource files in the second resource subpackage; The second directory item is written into the adjusted reference directory table to generate an upgraded directory table.

7. A file updating method, characterized in that: include: Build update request; The update request is sent to receive an upgrade catalog table and a second resource sub-package, wherein the upgrade catalog table and the second resource sub-package are both determined by the file packaging method according to any one of claims 1 to 6.

8. A file packaging device, characterized in that: include: An acquisition module, used to acquire a reference package system and a plurality of upgraded resource files, wherein the reference package system includes a reference directory table and a plurality of first resource sub-packages for storing original resource files, and the reference directory table is used to associate each of the original resource files; A first processing module, configured to determine a changed file in the original resource file and the upgraded resource file based on the reference package system and the upgraded resource file, and adjust the reference directory table based on the changed file; A second processing module, configured to determine the invalid data size of each of the first resource subpackages based on the adjusted reference directory table, wherein the invalid data size is negatively correlated with the sum of data sizes of all the original resource files associated with the reference directory table in the first resource subpackage; a repackaging module, configured to repack each of the first resource subpackages based on the change file to obtain a second resource subpackage when the size of the invalid data of the first resource subpackage is greater than or equal to a preset repackaging threshold; The sending module is used to generate an upgrade catalog table based on the adjusted reference catalog table and the second resource sub-package, and send the upgrade catalog table and the second resource sub-package when an update request is received.

9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the file packaging method described in any one of claims 1 to 6, or implements the file updating method described in claim 7 when executing the computer program.

10. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the file packaging method described in any one of claims 1 to 6, or implements the file updating method described in claim 7.