[go: up one dir, main page]

CN109889608B - Dynamic resource loading method and device, electronic equipment and storage medium - Google Patents

Dynamic resource loading method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN109889608B
CN109889608B CN201910253022.1A CN201910253022A CN109889608B CN 109889608 B CN109889608 B CN 109889608B CN 201910253022 A CN201910253022 A CN 201910253022A CN 109889608 B CN109889608 B CN 109889608B
Authority
CN
China
Prior art keywords
target
dynamic resource
resource
client
target dynamic
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910253022.1A
Other languages
Chinese (zh)
Other versions
CN109889608A (en
Inventor
邢天波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Internet Security Software Co Ltd
Original Assignee
Beijing Kingsoft Internet Security Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Internet Security Software Co Ltd filed Critical Beijing Kingsoft Internet Security Software Co Ltd
Priority to CN201910253022.1A priority Critical patent/CN109889608B/en
Publication of CN109889608A publication Critical patent/CN109889608A/en
Application granted granted Critical
Publication of CN109889608B publication Critical patent/CN109889608B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a dynamic resource loading method, a dynamic resource loading device, electronic equipment and a storage medium, wherein the method applied to a server comprises the following steps: determining each target dynamic resource corresponding to the target version number; compressing each target dynamic resource to obtain a target compressed file; and nesting the target compressed file into the resource installation package with the target version number to obtain the target resource installation package with the target version number, so that the client loads the target resource installation package according to the target version number. The method applied to the client comprises the following steps: after a client logs in a server, determining each target dynamic resource to be loaded by the client according to the version number of the client; determining target dynamic resources contained in local storage of the client according to the version number of the client and the identification of each target dynamic resource; and loading the target dynamic resource included in the local storage of the client. The invention realizes the rapid loading of the target dynamic resource and improves the user experience.

Description

Dynamic resource loading method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a dynamic resource loading method and apparatus, an electronic device, and a storage medium.
Background
With the rapid development of computer technology, online games have also been rapidly developed. Because of the increasingly abundant game resources and the increasingly vivid game experience, the online game attracts more and more users to use.
The game resources can be divided into installation package resources of the game and dynamic resources supporting dynamic loading which can not be placed in the installation package, and the dynamic resources are generally resources loaded in real time through a server. When the existing user enters the game software to play the game, the target dynamic resource of the game software needs to be loaded, namely the user needs to load the target dynamic resource from the server. The method of loading the target dynamic resource from the server is easily influenced by the network quality, and the user experience is influenced by long time consumption when the network quality is not good. Therefore, how to quickly load the target dynamic resource and improve the user experience is still an urgent technical problem to be solved.
Disclosure of Invention
Embodiments of the present invention provide a dynamic resource loading method, an apparatus, an electronic device, and a storage medium, so as to implement a method for directly loading a dynamic resource from a local without considering network quality, implement rapid loading of a target dynamic resource, and improve user experience. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention discloses a dynamic resource loading method, which is applied to a server, and the method includes:
determining each target dynamic resource corresponding to the target version number;
compressing each target dynamic resource to obtain a target compressed file;
and nesting the target compressed file into the resource installation package with the target version number to obtain the target resource installation package with the target version number, so that the client loads the target resource installation package according to the target version number.
Optionally, the compressing each of the target dynamic resources to obtain a target compressed file includes:
acquiring the quantity of each target dynamic resource, the size and the name of each target dynamic resource, and determining the offset address of each target dynamic resource;
generating header data according to the number of the target dynamic resources, the size, the name and the offset address of each target dynamic resource;
according to the header data, adding each target dynamic resource in the data stream of the header data to obtain a target data stream;
and compressing the target data stream through an lzma compression algorithm to obtain a target compressed file.
Optionally, each dynamic resource with the same version number is stored in one dynamic resource file, and each dynamic resource with only one version number is stored in one dynamic resource file; the determining of each target dynamic resource corresponding to the target version number includes:
acquiring a target dynamic resource file corresponding to the target version number;
and acquiring each target dynamic resource in the target dynamic resource file in a FileInfo file reading mode.
In a second aspect, an embodiment of the present invention discloses a dynamic resource loading method, which is applied to a client, and the method includes:
after a client logs in a server, determining each target dynamic resource to be loaded by the client according to the version number of the client;
determining the target dynamic resources included in the local storage of the client according to the version number of the client and the identification of each target dynamic resource;
and loading the target dynamic resource included in the local storage of the client.
Optionally, after the client logs in the server, before determining the target dynamic resource to be loaded by the client, the method further includes:
acquiring a target resource installation package of the client according to the target version number;
decompressing the target resource installation package to obtain each target dynamic resource in the target resource installation package;
and storing each target dynamic resource in a local storage of the client.
Optionally, the decompressing the target resource installation package to obtain each target dynamic resource in the target resource installation package includes:
decompressing the target resource installation package through an lzma decompression algorithm to obtain a target data stream;
reading the size, the name and the offset address of each target dynamic resource and the storage position of each target dynamic resource according to the header data of the target data stream;
and acquiring each target dynamic resource through each target dynamic resource storage position.
In a third aspect, an embodiment of the present invention discloses a dynamic resource loading apparatus, which is applied to a server, and the apparatus includes:
the target dynamic resource determining module is used for determining each target dynamic resource corresponding to the target version number;
the target compressed file determining module is used for compressing each target dynamic resource to obtain a target compressed file;
and the target resource installation package determining module is used for nesting the target compressed file into the resource installation package with the target version number to obtain the target resource installation package with the target version number, so that the client loads the target resource installation package according to the target version number.
Optionally, the target compressed file determining module includes:
the offset address determining submodule is used for acquiring the quantity of each target dynamic resource, the size and the name of each target dynamic resource and determining the offset address of each target dynamic resource;
the header data determining submodule is used for generating header data according to the number of the target dynamic resources, the size, the name and the offset address of each target dynamic resource;
the target data flow determining submodule is used for adding each target dynamic resource in the data flow of the header data according to the header data to obtain a target data flow;
and the target compressed file determining submodule is used for compressing the target data stream through an lzma compression algorithm to obtain a target compressed file.
Optionally, each dynamic resource with the same version number is stored in one dynamic resource file, and each dynamic resource with only one version number is stored in one dynamic resource file; the target dynamic resource determination module includes:
the target dynamic resource file determining submodule is used for acquiring a target dynamic resource file corresponding to the target version number;
and the target dynamic resource determining submodule is used for acquiring each target dynamic resource in the target dynamic resource file through the FileInfo file reading mode of the target dynamic resource file.
In a fourth aspect, an embodiment of the present invention discloses a dynamic resource loading apparatus, which is applied to a client, and the apparatus includes:
the system comprises a to-be-loaded target dynamic resource determining module, a loading target dynamic resource determining module and a loading target dynamic resource determining module, wherein the to-be-loaded target dynamic resource determining module is used for determining each target dynamic resource to be loaded by a client according to the version number of the client after the client logs in a server;
a local target dynamic resource determining module, configured to determine, according to the version number of the client and the identifier of each target dynamic resource, the target dynamic resource included in the local storage of the client;
and the local target dynamic resource loading module is used for loading the target dynamic resource included in the local storage of the client.
Optionally, the apparatus further comprises:
the target resource installation package determining module is used for acquiring the target resource installation package of the client according to the target version number;
the target resource installation package decompression module is used for decompressing the target resource installation package to obtain each target dynamic resource in the target resource installation package;
and the target dynamic resource storage module is used for storing each target dynamic resource in the local storage of the client.
Optionally, the target resource installation package decompression module includes:
the target data stream determining submodule is used for decompressing the target resource installation package through an lzma decompression algorithm to obtain a target data stream;
a target dynamic resource storage location determining submodule, configured to read, according to header data of the target data stream, a size, a name, and an offset address of each target dynamic resource and a storage location of each target dynamic resource;
and the target dynamic resource acquisition submodule is used for acquiring each target dynamic resource through each target dynamic resource storage position.
In a fifth aspect, an embodiment of the present invention discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement, when executing the program stored in the memory, any one of the method steps of the dynamic resource loading method applied to the server, or any one of the method steps of the dynamic resource loading method applied to the client.
In a sixth aspect, an embodiment of the present invention discloses a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method step of any one of the above dynamic resource loading methods applied to a server is implemented, or the method step of any one of the above dynamic resource loading methods applied to a client is implemented.
In the dynamic resource loading method, the dynamic resource loading device, the electronic device, and the storage medium provided by the embodiments of the present invention, at the server, each target dynamic resource is obtained according to the version number, each target dynamic resource is compressed into a target compressed file, and the target compressed file is embedded in the resource installation package of the target version number, so as to obtain the target resource installation package of the target version number. And the target dynamic resources are compressed into target compressed files and are nested in the resource installation package, so that the size of the resources acquired by the client is reduced, and the client can download the resources conveniently. After the client obtains the target resource installation package for the first time, the target dynamic resource can be directly obtained from the package body in a decompression mode, and the target dynamic resource is conveniently stored to the local client.
After the client determines each target dynamic resource to be loaded at this time by logging in the server, the client can determine the target dynamic resource included in the local storage of the client according to the version number of the client and the identifier of each target dynamic resource, and further directly load the target dynamic resource included in the local storage of the client. The dynamic resource loading method of the embodiment of the invention does not need the client to download the dynamic resources from the server, thereby reducing the flow consumption of the client. The client directly loads the locally stored target dynamic resource, so that the aims of quickly loading the target dynamic resource and improving the user experience are fulfilled.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a flowchart of a dynamic resource loading method according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for determining a target compressed file in a dynamic resource loading method according to an embodiment of the present invention;
FIG. 3 is a flowchart of a dynamic resource loading method according to an embodiment of the present invention;
fig. 4 is a schematic diagram illustrating a client decompressing a target compressed file in a dynamic resource loading method according to an embodiment of the present invention;
fig. 5 is a flowchart of a client decompression method in a dynamic resource loading method according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a dynamic resource loading apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a dynamic resource loading apparatus according to an embodiment of the present invention
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
In a first aspect, an embodiment of the present invention discloses a dynamic resource loading method, which is applied to a server, as shown in fig. 1. Fig. 1 is a flowchart of a dynamic resource loading method according to an embodiment of the present invention, where the method includes:
and S101, determining each target dynamic resource corresponding to the target version number.
In this step, the target dynamic resource to be nested into the resource installation package is determined. And determining the target dynamic resource corresponding to the version number according to the version number, wherein the target version number is the version number of the target dynamic resource required to be determined at this time.
Optionally, each dynamic resource with the same version number is stored in one dynamic resource file, and each dynamic resource with only one version number is stored in one dynamic resource file; determining each target dynamic resource corresponding to the target version number, including:
step one, acquiring a target dynamic resource file corresponding to a target version number.
In this embodiment, each dynamic resource file may be packaged in advance through a resource packaging interface of the Unity engine to generate an AssetBundle file having a resource association relationship, and the AssetBundle resources are stored in dynamic resource files with the same version number, where only one version number of each dynamic resource is stored in one dynamic resource file.
In this step, the target dynamic resource file corresponding to the target version number can be found through the target version number.
And step two, acquiring each target dynamic resource in the target dynamic resource file in a FileInfo file reading mode.
In this step, each target dynamic resource in the target dynamic resource file is read in a traversal manner through a FileInfo file reading manner.
S102, compressing each target dynamic resource to obtain a target compressed file.
In this step, each target dynamic resource may be compressed individually to produce a plurality of target compressed files. In addition, each target dynamic resource can form a large data stream, and the data stream is compressed into a target compressed file, so that the compressed file is conveniently embedded into the resource installation package.
S103, the target compressed file is nested into the resource installation package with the target version number to obtain the target resource installation package with the target version number, so that the client loads the target resource installation package according to the target version number.
The resource installation package of the embodiment is an application installation package, such as a game installation package.
In this step, the target compressed file may be randomly embedded to any position of the resource installation package of the target version number in a nested form.
For example, the target compressed file may be Application, and in this step, the target compressed file is embedded into a resource installation package with a target version number, so that when the client obtains the installation of the target resource installation package, the running App can obtain a resource stored in a specific location of the target compressed file in the package body, where the specific location is Application. Application. And adding the target dynamic resource to application.
In the dynamic resource loading method provided by the embodiment of the invention, at the server, each target dynamic resource is obtained according to the version number, each target dynamic resource is compressed into a target compressed file, and the target compressed file is embedded into the resource installation package of the target version number, so that the target resource installation package of the target version number is obtained. And the target dynamic resources are compressed into target compressed files and are nested in the resource installation package, so that the size of the resources acquired by the client is reduced, and the client can download the resources conveniently. After the client obtains the target resource installation package for the first time, the target dynamic resource can be directly obtained from the package body in a decompression mode, and the target dynamic resource is conveniently stored to the local client.
Optionally, in the above S102, each target dynamic resource is compressed to obtain a target compressed file, which can be referred to in fig. 2. Fig. 2 is a flowchart of a method for determining a target compressed file in a dynamic resource loading method according to an embodiment of the present invention, where the method includes:
s201, obtaining the number of each target dynamic resource, the size and the name of each target dynamic resource, and determining the offset address of each target dynamic resource.
To better illustrate the generation process of the target data stream, refer to the target data stream shown in table 1.
TABLE 1 target data flow
Figure BDA0002012857010000081
Figure BDA0002012857010000091
The offset address of this step is the starting location of the data storage for each target dynamic resource. In this step, after the number of the target dynamic resources, the size of the target dynamic resources, and the size of the bytes occupied by the names of the target dynamic resources are determined, the offset address occupied bytes of the target dynamic resources may be attached to the size occupied bytes of the target dynamic resources, and the next target dynamic resource is determined by combining the size of the target dynamic resources of the next target dynamic resource, and so on, the offset addresses of all the target dynamic resources are determined.
S202, generating header data according to the number of the target dynamic resources, the size, the name and the offset address of each target dynamic resource.
As shown in table 1, the amount of the target dynamic resource can be placed at the beginning field position of the data stream, and 4 bytes are allocated to store the amount of the target dynamic resource; the index of the target dynamic resource may be a storage order allocated to all target dynamic resources, and may be 0, 1, 2, and 3 …, and may allocate 4 bytes to the index of each target dynamic resource, for example, allocate 4 bytes to index 0 of target dynamic resource 1, and allocate 4 bytes to index 1 of target dynamic resource 2, where the index of the target dynamic resource is to facilitate a client to find header information of each target dynamic resource from the index and slice the header information to obtain each complete target dynamic resource when obtaining a target data stream. After the index byte of the target dynamic resource, 4 bytes can be allocated to store the name of the first target dynamic resource; after the name byte of the first target dynamic resource, 4 bytes can be allocated to store the size of the first target dynamic resource; after the size byte of the first target dynamic resource, 4 bytes may be allocated to store the offset address of the first target dynamic resource, where the offset address is the address that determines the first target dynamic resource to start storing bytes. According to the sequence, the data flow corresponding to the basic information of all target dynamic resources is determined, and the header data is generated.
And S203, adding each target dynamic resource in the data stream of the header data according to the header data to obtain the target data stream.
After generating the header data, storing each target dynamic resource to the identifier byte position of the corresponding offset address according to the corresponding offset address, so as to obtain the target data stream corresponding to each target dynamic resource, as shown in table 1.
The manner of obtaining the target data stream according to the header data in table 1 is only one manner of constructing the target data stream. For example, when the client directly stores the target data stream after obtaining the entire target data stream, and does not need to slice the data stream to restore the dynamic resources of multiple targets, the index of the target dynamic resource in table 1 above may be removed.
And S204, compressing the target data stream through an lzma compression algorithm to obtain a target compressed file.
The embodiment of the invention can realize that each target dynamic resource forms a large data stream, and the data stream is compressed into a target compressed file, so that the data stream can be conveniently embedded into the resource installation package of the target version number. In addition, for the client, the target compressed file embedded with the target dynamic resources can be directly downloaded, and compared with the method that the client directly obtains a plurality of target dynamic resources from the server, the data size is reduced, and the downloading speed is improved.
In a second aspect, an embodiment of the present invention discloses a dynamic resource loading method, which is applied to a client, as shown in fig. 3. Fig. 3 is a flowchart of a dynamic resource loading method according to an embodiment of the present invention, where the method includes:
s301, after the client logs in the server, determining each target dynamic resource to be loaded by the client according to the version number of the client.
After logging in the server, the client can directly verify the version number of the client and the resource version number of the server to determine each target dynamic resource to be loaded by the client.
S302, determining the target dynamic resources included in the local storage of the client according to the identification of each target dynamic resource.
After determining each target dynamic resource, the identifier of each target dynamic resource in the target dynamic resource index stored in advance locally can be searched, and each target dynamic resource of the target dynamic resources included in the local storage of the client is determined. The identification of the target dynamic resource may be encoded as md5 for the target dynamic resource.
S302, loading the target dynamic resource included in the local storage of the client.
In this step, the target dynamic resource stored in advance can be acquired from the local disk, and then the target dynamic resource is loaded from the local, and the loading process does not need to consume flow.
In the dynamic resource loading method, after the client determines each target dynamic resource to be loaded at this time by logging in the server, the client can determine the target dynamic resource included in the local storage of the client according to the version number of the client and the identifier of each target dynamic resource, and further directly load the target dynamic resource included in the local storage of the client. The dynamic resource loading method of the embodiment of the invention does not need the client to download the dynamic resources from the server, thereby reducing the flow consumption of the client. The client directly loads the locally stored target dynamic resource, so that the aims of quickly loading the target dynamic resource and improving the user experience are fulfilled.
Optionally, in an embodiment of the dynamic resource loading method of the present invention, after the client logs in the server, before determining the target dynamic resource to be loaded by the client, the method further includes:
and step A, acquiring a target resource installation package of the client according to the target version number.
In this step, when the application software is installed for the first time, the target version number may be sent to the server, and the target resource installation package corresponding to the target version number is downloaded from the server.
And B, decompressing the target resource installation package to obtain each target dynamic resource in the target resource installation package.
In this step, the target resource installation package is decompressed in the same compression mode as the server side, and each installation file of the application software included in the target resource installation and each target dynamic resource are obtained. And judging which one is the installation file and which one is the target compressed file containing each target dynamic resource according to the file name or the file identifier, and decompressing the target compressed file to obtain each target dynamic resource.
For example, if the application software is racing game software, there may be a schematic diagram that a client decompresses a target compressed file in the dynamic resource loading method according to the embodiment of the present invention shown in fig. 4. The process is decompression performed locally at the client, without consuming user traffic.
And step C, storing each target dynamic resource in a local storage of the client.
By the embodiment of the invention, the target resource installation package containing the target dynamic resource can be obtained in advance, the target resource installation package is decompressed to obtain each target dynamic resource, each target dynamic resource is stored in the local, and when the target dynamic resource needs to be loaded, the target dynamic resource is directly loaded from the local without being downloaded from a server, so that the consumption of user flow is reduced. And the network quality is not considered from the local loading, the loading speed is high, and the user experience is improved.
Optionally, in an embodiment of the dynamic resource loading method of the present invention, the target resource installation package is decompressed to obtain each target dynamic resource in the target resource installation package, as shown in fig. 5. Fig. 5 is a flowchart of a client decompression method in a dynamic resource loading method according to the present invention, including:
s501, decompressing the target resource installation package through an lzma decompression algorithm to obtain a target data stream.
In this step, the target resource installation package is decompressed through an lzma decompression algorithm to obtain the target data stream shown in table 1.
S502, according to the header data of the target data stream, the size, the name and the offset address of each target dynamic resource and the storage position of each target dynamic resource are read.
In this step, switching may be performed according to the index of the target dynamic resource in table 1, and then the size, name, and offset address of each target dynamic resource and the storage location of each target dynamic resource may be read according to the target data stream form in table 1.
S503, obtaining each target dynamic resource through each target dynamic resource storage position.
In this step, starting from the offset address of the target dynamic resource 1 in table 1, the starting position of the storage of the target dynamic resource 1 is determined, and the data of the corresponding byte length is read according to the size of the target dynamic resource 1, that is, the target dynamic resource 1 can be read; and determining the starting position of the storage of the target dynamic resource 2 according to the offset address of the target dynamic resource 2, reading data with corresponding byte length according to the size of the target dynamic resource 2, namely reading the target dynamic resource 2, and so on to obtain each target dynamic resource. And storing each target dynamic resource locally, and further establishing a local storage index for each dynamic resource, so as to facilitate local loading.
By the embodiment of the invention, the target resource installation package containing the target dynamic resource can be obtained in advance, and then the target resource installation package is decompressed to obtain each target dynamic resource, so that each target dynamic resource is conveniently stored locally, and direct local loading in the later period is realized.
In a third aspect, an embodiment of the present invention discloses a dynamic resource loading apparatus, which is applied to a server, as shown in fig. 6. Fig. 6 is a schematic structural diagram of a dynamic resource loading apparatus according to an embodiment of the present invention, where the apparatus includes:
a target dynamic resource determining module 601, configured to determine each target dynamic resource corresponding to the target version number;
a target compressed file determining module 602, configured to compress each target dynamic resource to obtain a target compressed file;
the target resource installation package determining module 603 is configured to nest the target compressed file into the resource installation package with the target version number, so as to obtain the target resource installation package with the target version number, and enable the client to load the target resource installation package according to the target version number.
In the dynamic resource loading apparatus provided in the embodiment of the present invention, at the server, each target dynamic resource is obtained according to the version number, each target dynamic resource is compressed into a target compressed file, and the target compressed file is embedded in the resource installation package of the target version number, so as to obtain the target resource installation package of the target version number. And the target dynamic resources are compressed into target compressed files and are nested in the resource installation package, so that the size of the resources acquired by the client is reduced, and the client can download the resources conveniently. After the client obtains the target resource installation package for the first time, the target dynamic resource can be directly obtained from the package body in a decompression mode, and the target dynamic resource is conveniently stored to the local client.
Optionally, in an embodiment of the dynamic resource loading apparatus of the present invention, the target compressed file determining module 602 includes:
the offset address determining submodule is used for acquiring the number of each target dynamic resource, the size and the name of each target dynamic resource and determining the offset address of each target dynamic resource;
the header data determining submodule is used for generating header data according to the number of the target dynamic resources, the size, the name and the offset address of each target dynamic resource;
the target data flow determining submodule is used for adding each target dynamic resource in the data flow of the header data according to the header data to obtain a target data flow;
and the target compressed file determining submodule is used for compressing the target data stream through an lzma compression algorithm to obtain a target compressed file.
Optionally, in an embodiment of the dynamic resource loading apparatus of the present invention, each dynamic resource with the same version number is stored in one dynamic resource file, and each dynamic resource with only one version number is stored in one dynamic resource file; the target dynamic resource determination module 601 includes:
the target dynamic resource file determining submodule is used for acquiring a target dynamic resource file corresponding to the target version number;
and the target dynamic resource determining submodule is used for acquiring each target dynamic resource in the target dynamic resource file through the FileInfo file reading mode of the target dynamic resource file.
In a fourth aspect, an embodiment of the present invention discloses a dynamic resource loading apparatus, which is applied to a client, as shown in fig. 7. Fig. 7 is a schematic structural diagram of a dynamic resource loading apparatus according to an embodiment of the present invention, where the apparatus includes:
a to-be-loaded target dynamic resource determining module 701, configured to determine, after the client logs in the server, each target dynamic resource to be loaded by the client according to the version number of the client;
a local target dynamic resource determining module 702, configured to determine a target dynamic resource included in the local storage of the client according to the version number of the client and the identifier of each target dynamic resource;
a local target dynamic resource loading module 703, configured to load a target dynamic resource included in the client local storage.
In the dynamic resource loading device, after the client determines each target dynamic resource to be loaded at this time by logging in the server, the client can determine the target dynamic resource included in the local storage of the client according to the version number of the client and the identifier of each target dynamic resource, and further directly load the target dynamic resource included in the local storage of the client. The dynamic resource loading method of the embodiment of the invention does not need the client to download the dynamic resources from the server, thereby reducing the flow consumption of the client. The client directly loads the locally stored target dynamic resource, so that the aims of quickly loading the target dynamic resource and improving the user experience are fulfilled.
Optionally, in an embodiment of the dynamic resource loading apparatus of the present invention, the apparatus further includes:
the target resource installation package determining module is used for acquiring a target resource installation package of the client according to the target version number;
the target resource installation package decompression module is used for decompressing the target resource installation package to obtain each target dynamic resource in the target resource installation package;
and the target dynamic resource storage module is used for storing each target dynamic resource in the local storage of the client.
Optionally, in an embodiment of the dynamic resource loading apparatus of the present invention, the target resource installation package decompression module includes:
the target data flow determining submodule is used for decompressing the target resource installation package through an lzma decompression algorithm to obtain a target data flow;
the target dynamic resource storage position determining submodule is used for reading the size, the name and the offset address of each target dynamic resource and the storage position of each target dynamic resource according to the header data of the target data stream;
and the target dynamic resource acquisition submodule is used for acquiring each target dynamic resource through the storage position of each target dynamic resource.
In a fifth aspect, an embodiment of the present invention discloses an electronic device, as shown in fig. 8. Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, which includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804, where the processor 801, the communication interface 802, and the memory 803 complete communication with each other through the communication bus 804;
a memory 803 for storing a computer program;
the processor 801 is configured to implement the following method steps when executing the program stored in the memory 803:
determining each target dynamic resource corresponding to the target version number;
compressing each target dynamic resource to obtain a target compressed file;
and nesting the target compressed file into the resource installation package with the target version number to obtain the target resource installation package with the target version number, so that the client loads the target resource installation package according to the target version number.
Or the processor 801, when executing the program stored in the memory 803, to implement the following method steps:
after a client logs in a server, determining each target dynamic resource to be loaded by the client according to the version number of the client;
determining target dynamic resources contained in local storage of the client according to the version number of the client and the identification of each target dynamic resource;
and loading the target dynamic resource included in the local storage of the client.
The communication bus 804 mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 804 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface 802 is used for communication between the above-described electronic apparatus and other apparatuses.
The Memory 803 may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory 803 may also be at least one storage device located remotely from the processor 801.
The Processor 801 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In the electronic device provided by the embodiment of the invention, at the server, each target dynamic resource is obtained according to the version number, each target dynamic resource is compressed into a target compressed file, and the target compressed file is embedded into the resource installation package of the target version number, so that the target resource installation package of the target version number is obtained. And the target dynamic resources are compressed into target compressed files and are nested in the resource installation package, so that the size of the resources acquired by the client is reduced, and the client can download the resources conveniently. After the client obtains the target resource installation package for the first time, the target dynamic resource can be directly obtained from the package body in a decompression mode, and the target dynamic resource is conveniently stored to the local client.
After the client determines each target dynamic resource to be loaded at this time by logging in the server, the client can determine the target dynamic resource included in the local storage of the client according to the version number of the client and the identifier of each target dynamic resource, and further directly load the target dynamic resource included in the local storage of the client. The dynamic resource loading method of the embodiment of the invention does not need the client to download the dynamic resources from the server, thereby reducing the flow consumption of the client. The client directly loads the locally stored target dynamic resource, so that the aims of quickly loading the target dynamic resource and improving the user experience are fulfilled.
In a sixth aspect, an embodiment of the present invention discloses a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method step of any one of the above dynamic resource loading methods applied to a server is implemented, or the method step of any one of the above dynamic resource loading methods applied to a client is implemented.
In the computer-readable storage medium provided by the embodiment of the present invention, at the server, each target dynamic resource is obtained according to the version number, each target dynamic resource is compressed into a target compressed file, and the target compressed file is embedded into the resource installation package of the target version number, so as to obtain the target resource installation package of the target version number. And the target dynamic resources are compressed into target compressed files and are nested in the resource installation package, so that the size of the resources acquired by the client is reduced, and the client can download the resources conveniently. After the client obtains the target resource installation package for the first time, the target dynamic resource can be directly obtained from the package body in a decompression mode, and the target dynamic resource is conveniently stored to the local client.
After the client determines each target dynamic resource to be loaded at this time by logging in the server, the client can determine the target dynamic resource included in the local storage of the client according to the version number of the client and the identifier of each target dynamic resource, and further directly load the target dynamic resource included in the local storage of the client. The dynamic resource loading method of the embodiment of the invention does not need the client to download the dynamic resources from the server, thereby reducing the flow consumption of the client. The client directly loads the locally stored target dynamic resource, so that the aims of quickly loading the target dynamic resource and improving the user experience are fulfilled.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the device, the electronic apparatus and the storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and the relevant points can be referred to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (14)

1. A dynamic resource loading method is applied to a server side, and the method comprises the following steps:
determining each target dynamic resource corresponding to the target version number;
compressing each target dynamic resource to obtain a target compressed file;
nesting the target compressed file into the resource installation package with the target version number to obtain a target resource installation package with a target version number, so that a client loads the target dynamic resource in the target resource installation package according to the target version number, wherein the client loads the target dynamic resource in the target resource installation package according to the target version number, and the method comprises the following steps: after the client logs in a server, determining each target dynamic resource to be loaded by the client according to the version number of the client; determining the target dynamic resources included in the local storage of the client according to the version number of the client and the identification of each target dynamic resource; and loading the target dynamic resource included in the local storage of the client.
2. The method according to claim 1, wherein the compressing each of the target dynamic resources to obtain a target compressed file comprises:
acquiring the quantity of each target dynamic resource, the size and the name of each target dynamic resource, and determining the offset address of each target dynamic resource;
generating header data according to the number of the target dynamic resources, the size, the name and the offset address of each target dynamic resource;
according to the header data, adding each target dynamic resource in the data stream of the header data to obtain a target data stream;
and compressing the target data stream through an lzma compression algorithm to obtain a target compressed file.
3. The dynamic resource loading method according to claim 1, wherein each dynamic resource with the same version number is stored in one dynamic resource file, and each dynamic resource with only one version number is stored in one dynamic resource file; the determining of each target dynamic resource corresponding to the target version number includes:
acquiring a target dynamic resource file corresponding to the target version number;
and acquiring each target dynamic resource in the target dynamic resource file in a FileInfo file reading mode.
4. A dynamic resource loading method is applied to a client, and the method comprises the following steps:
after a client logs in a server, determining each target dynamic resource to be loaded by the client according to the version number of the client;
determining the target dynamic resources included in the local storage of the client according to the version number of the client and the identification of each target dynamic resource;
loading the target dynamic resource included in the client local storage;
wherein the target dynamic resource included in the client local storage is a target dynamic resource in a target resource installation package, and the target resource installation package is: the server determines each target dynamic resource corresponding to the target version number; compressing each target dynamic resource to obtain a target compressed file; and nesting the target compressed file into the resource installation package of the target version number to obtain the resource installation package.
5. The method according to claim 4, wherein after the client logs in the server and before the target dynamic resource to be loaded by the client is determined, the method further comprises:
acquiring a target resource installation package of the client according to the target version number;
decompressing the target resource installation package to obtain each target dynamic resource in the target resource installation package;
and storing each target dynamic resource in a local storage of the client.
6. The method of claim 5, wherein the decompressing the target resource installation package to obtain each target dynamic resource in the target resource installation package comprises:
decompressing the target resource installation package through an lzma decompression algorithm to obtain a target data stream;
reading the size, the name and the offset address of each target dynamic resource and the storage position of each target dynamic resource according to the header data of the target data stream;
and acquiring each target dynamic resource through each target dynamic resource storage position.
7. A dynamic resource loading device, applied to a server, the device comprising:
the target dynamic resource determining module is used for determining each target dynamic resource corresponding to the target version number;
the target compressed file determining module is used for compressing each target dynamic resource to obtain a target compressed file;
a target resource installation package determining module, configured to nest the target compressed file into the resource installation package with the target version number, so as to obtain a target resource installation package with a target version number, so that a client loads the target dynamic resource in the target resource installation package according to the target version number, where the client loads the target dynamic resource in the target resource installation package according to the target version number, and the target resource installation package determining module includes: after the client logs in a server, determining each target dynamic resource to be loaded by the client according to the version number of the client; determining the target dynamic resources included in the local storage of the client according to the version number of the client and the identification of each target dynamic resource; and loading the target dynamic resource included in the local storage of the client.
8. The dynamic resource loading apparatus according to claim 7, wherein the target compressed file determining module comprises:
the offset address determining submodule is used for acquiring the quantity of each target dynamic resource, the size and the name of each target dynamic resource and determining the offset address of each target dynamic resource;
the header data determining submodule is used for generating header data according to the number of the target dynamic resources, the size, the name and the offset address of each target dynamic resource;
the target data flow determining submodule is used for adding each target dynamic resource in the data flow of the header data according to the header data to obtain a target data flow;
and the target compressed file determining submodule is used for compressing the target data stream through an lzma compression algorithm to obtain a target compressed file.
9. The dynamic resource loading apparatus according to claim 7, wherein each dynamic resource with the same version number is stored in one dynamic resource file, and each dynamic resource with only one version number is stored in one dynamic resource file; the target dynamic resource determination module includes:
the target dynamic resource file determining submodule is used for acquiring a target dynamic resource file corresponding to the target version number;
and the target dynamic resource determining submodule is used for acquiring each target dynamic resource in the target dynamic resource file through the FileInfo file reading mode of the target dynamic resource file.
10. A dynamic resource loading device applied to a client, the device comprising:
the system comprises a to-be-loaded target dynamic resource determining module, a loading target dynamic resource determining module and a loading target dynamic resource determining module, wherein the to-be-loaded target dynamic resource determining module is used for determining each target dynamic resource to be loaded by a client according to the version number of the client after the client logs in a server;
a local target dynamic resource determining module, configured to determine, according to the version number of the client and the identifier of each target dynamic resource, the target dynamic resource included in the local storage of the client;
a local target dynamic resource loading module, configured to load the target dynamic resource included in the local storage of the client;
wherein the target dynamic resource included in the client local storage is a target dynamic resource in a target resource installation package, and the target resource installation package is: the server determines each target dynamic resource corresponding to the target version number; compressing each target dynamic resource to obtain a target compressed file; and nesting the target compressed file into the resource installation package of the target version number to obtain the resource installation package.
11. The dynamic resource loading apparatus of claim 10, wherein the apparatus further comprises:
the target resource installation package determining module is used for acquiring the target resource installation package of the client according to the target version number;
the target resource installation package decompression module is used for decompressing the target resource installation package to obtain each target dynamic resource in the target resource installation package;
and the target dynamic resource storage module is used for storing each target dynamic resource in the local storage of the client.
12. The dynamic resource loading apparatus of claim 11, wherein the target resource installation package decompression module comprises:
the target data stream determining submodule is used for decompressing the target resource installation package through an lzma decompression algorithm to obtain a target data stream;
a target dynamic resource storage location determining submodule, configured to read, according to header data of the target data stream, a size, a name, and an offset address of each target dynamic resource and a storage location of each target dynamic resource;
and the target dynamic resource acquisition submodule is used for acquiring each target dynamic resource through each target dynamic resource storage position.
13. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
the memory is used for storing a computer program;
the processor, when executing the program stored in the memory, implementing the method steps of any of claims 1-3 or 4-6.
14. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method steps of any one of claims 1 to 3 or 4 to 6.
CN201910253022.1A 2019-03-29 2019-03-29 Dynamic resource loading method and device, electronic equipment and storage medium Active CN109889608B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910253022.1A CN109889608B (en) 2019-03-29 2019-03-29 Dynamic resource loading method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910253022.1A CN109889608B (en) 2019-03-29 2019-03-29 Dynamic resource loading method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109889608A CN109889608A (en) 2019-06-14
CN109889608B true CN109889608B (en) 2021-12-10

Family

ID=66935426

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910253022.1A Active CN109889608B (en) 2019-03-29 2019-03-29 Dynamic resource loading method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109889608B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112395437B (en) * 2019-08-16 2024-04-30 北京百度网讯科技有限公司 3D model loading method and device, electronic equipment and storage medium

Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7290259B2 (en) * 2000-12-28 2007-10-30 Hitachi, Ltd. Virtual computer system with dynamic resource reallocation
CN102081650A (en) * 2010-12-29 2011-06-01 上海网达软件有限公司 Method for rapidly displaying user interface of embedded type platform
CN102263805A (en) * 2010-05-25 2011-11-30 腾讯科技(北京)有限公司 Dynamic resource downloading method and apparatus thereof
CN102340497A (en) * 2010-07-23 2012-02-01 北京乐升科技有限公司 Online game system and online game resource processing method
CN102736940A (en) * 2012-06-21 2012-10-17 北京像素软件科技股份有限公司 Resource loading method
CN103095838A (en) * 2013-01-16 2013-05-08 福州博远无线网络科技有限公司 Method for upgrading Android smartphone software through downloading incremental upgrade package
US8738686B2 (en) * 2009-12-30 2014-05-27 Teradata Us, Inc. Dynamic resource management
CN103902696A (en) * 2014-03-28 2014-07-02 广州华多网络科技有限公司 Method and device for loading resource files
CN104104645A (en) * 2013-04-01 2014-10-15 北京畅游天下网络技术有限公司 Cross-platform resource management method and system
CN104714982A (en) * 2013-12-17 2015-06-17 阿里巴巴集团控股有限公司 Method and system for loading webpage
CN105511889A (en) * 2016-01-15 2016-04-20 珠海金山网络游戏科技有限公司 General game version incremental updating system and method
CN106354539A (en) * 2016-10-19 2017-01-25 乐视控股(北京)有限公司 Application program updating method and device
CN106897336A (en) * 2016-06-28 2017-06-27 阿里巴巴集团控股有限公司 Web page files sending method, webpage rendering intent and device, webpage rendering system
CN107038044A (en) * 2017-03-27 2017-08-11 长沙趣动文化科技有限公司 The discrete loading method of game resource and system based on Unity3D
CN107885540A (en) * 2016-09-28 2018-04-06 腾讯科技(深圳)有限公司 A kind of method, apparatus and terminal of loading application programs static resource
CN108132991A (en) * 2017-12-20 2018-06-08 上海斐讯数据通信技术有限公司 A kind of H5 pages loading method and system
CN108932332A (en) * 2018-07-05 2018-12-04 麒麟合盛网络技术股份有限公司 The loading method and device of static resource
CN109344619A (en) * 2018-08-15 2019-02-15 北京奇艺世纪科技有限公司 The hot restorative procedure and device of application program

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10514857B2 (en) * 2013-08-29 2019-12-24 Pure Storage, Inc. Dynamic adjusting of parameters based on resource scoring
CN108304229B (en) * 2018-01-30 2019-02-19 北京市安全生产科学技术研究院 A method and system for dynamic loading generation of safety production VR training level model
CN108888951A (en) * 2018-06-25 2018-11-27 网易(杭州)网络有限公司 Game resource treating method and apparatus

Patent Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7290259B2 (en) * 2000-12-28 2007-10-30 Hitachi, Ltd. Virtual computer system with dynamic resource reallocation
US8738686B2 (en) * 2009-12-30 2014-05-27 Teradata Us, Inc. Dynamic resource management
CN102263805A (en) * 2010-05-25 2011-11-30 腾讯科技(北京)有限公司 Dynamic resource downloading method and apparatus thereof
CN102340497A (en) * 2010-07-23 2012-02-01 北京乐升科技有限公司 Online game system and online game resource processing method
CN102081650A (en) * 2010-12-29 2011-06-01 上海网达软件有限公司 Method for rapidly displaying user interface of embedded type platform
CN102736940A (en) * 2012-06-21 2012-10-17 北京像素软件科技股份有限公司 Resource loading method
CN103095838A (en) * 2013-01-16 2013-05-08 福州博远无线网络科技有限公司 Method for upgrading Android smartphone software through downloading incremental upgrade package
CN104104645A (en) * 2013-04-01 2014-10-15 北京畅游天下网络技术有限公司 Cross-platform resource management method and system
CN104714982A (en) * 2013-12-17 2015-06-17 阿里巴巴集团控股有限公司 Method and system for loading webpage
CN103902696A (en) * 2014-03-28 2014-07-02 广州华多网络科技有限公司 Method and device for loading resource files
CN105511889A (en) * 2016-01-15 2016-04-20 珠海金山网络游戏科技有限公司 General game version incremental updating system and method
CN106897336A (en) * 2016-06-28 2017-06-27 阿里巴巴集团控股有限公司 Web page files sending method, webpage rendering intent and device, webpage rendering system
CN107885540A (en) * 2016-09-28 2018-04-06 腾讯科技(深圳)有限公司 A kind of method, apparatus and terminal of loading application programs static resource
CN106354539A (en) * 2016-10-19 2017-01-25 乐视控股(北京)有限公司 Application program updating method and device
CN107038044A (en) * 2017-03-27 2017-08-11 长沙趣动文化科技有限公司 The discrete loading method of game resource and system based on Unity3D
CN108132991A (en) * 2017-12-20 2018-06-08 上海斐讯数据通信技术有限公司 A kind of H5 pages loading method and system
CN108932332A (en) * 2018-07-05 2018-12-04 麒麟合盛网络技术股份有限公司 The loading method and device of static resource
CN109344619A (en) * 2018-08-15 2019-02-15 北京奇艺世纪科技有限公司 The hot restorative procedure and device of application program

Also Published As

Publication number Publication date
CN109889608A (en) 2019-06-14

Similar Documents

Publication Publication Date Title
CN113055451B (en) Resource downloading method and device, electronic equipment and storage medium
CN110018788B (en) Hierarchical storage method, hierarchical storage device, electronic equipment and computer readable storage medium
CN111615716B (en) Allocating shaders among client machines for pre-caching
CN106407207B (en) Real-time newly-added data updating method and device
CN113411404A (en) File downloading method, device, server and storage medium
CN110661829A (en) File downloading method and device, client and computer readable storage medium
CN109756533B (en) Mirror image acceleration method and device and server
CN106685429B (en) Integer compression method and device
CN111803917B (en) Resource processing method and device
CN113010455B (en) Data processing method and device and electronic equipment
CN109889608B (en) Dynamic resource loading method and device, electronic equipment and storage medium
CN108958755B (en) Method and device for generating application program installation package and electronic equipment
CN111198885A (en) Data processing method and device
CN110213643B (en) Streaming media caching method and device and terminal equipment
CN109617708B (en) Compression method, device and system for embedded point log
CN114564227A (en) Application program updating method and device, electronic equipment and storage medium
CN113411364B (en) Resource acquisition method and device and server
CN110019347B (en) Data processing method and device of block chain and terminal equipment
CN110020290B (en) Webpage resource caching method and device, storage medium and electronic device
CN112286706A (en) Remote and rapid acquisition method for application information of android application and related equipment
CN109995863B (en) Dynamic resource downloading method and device, electronic equipment and storage medium
CN109145220B (en) Data processing method and device and electronic equipment
CN113849125B (en) CDN server disk reading method, device and system
CN110321133B (en) H5 application deployment method and device
CN110213314B (en) Method, device and server for determining storage node

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant