Data processing method and device, electronic equipment and computer readable storage medium
By determining the loading paths of resources and whitelist resources in the project, the redundant resources are accurately filtered out and cleaned up, the performance problems and the risk of false deletion caused by redundant resource accumulation are solved, and efficient resource management and user experience improvement are achieved.
Patent Information
- Application Number
- CN202510113468.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-06-10
AI Technical Summary
In project development, the accumulation of redundant resources leads to an increase in the game package, the data loading time is too long, which affects the user experience. The existing technology's redundant resource cleaning efficiency is low and it is easy to accidentally delete non-redundant resources.
By determining the loading paths of resources in use and whitelist resources, the real redundant resources are accurately filtered out and cleaned up to ensure the effectiveness and integrity of the resources.
It improves the efficiency of redundant resources, reduces the risk of resource deletion, ensures the effectiveness and integrity of resources, and improves user experience.
Smart Images

Figure CN120114847A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method, device, electronic device and computer-readable storage medium. Background Art
[0002] In project development, resource management is an important part of ensuring application performance and user experience. For example, in the field of game development, with the continuous enrichment and iteration of game content, such as adding new features, optimizing visual effects, opening new levels, etc., new resource files (such as images, audio, video, etc.) will inevitably be introduced. The accumulation of redundant resources will cause the game package to continue to grow. On the one hand, redundant resources will occupy additional space, and on the other hand, the accumulation of redundant resources will cause data loading time to be too long, which will affect the overall user experience.
[0003] In the related art, one method is to manually clean up redundant resources, but this method is inefficient and requires a lot of time and manpower costs, resulting in a low efficiency in cleaning up redundant resources. In order to free up manpower, the number of resource loadings is usually collected and counted through data collection after the game is launched. When the number of loadings of a resource is 0 within a period of time, the resource is automatically cleaned up. However, some non-redundant resources may be loaded 0 times within a period of time due to infrequent use. For example, the usage rate of the game manual in the game is usually low, which will cause non-redundant resources to be accidentally deleted.
[0004] Therefore, it is extremely important to improve the efficiency of cleaning up redundant resources while reducing the risk of accidental resource deletion. Summary of the invention
[0005] The present application provides a data processing method, device, electronic device, and computer-readable storage medium, which can improve the cleaning efficiency of redundant resources while reducing the risk of accidental deletion of resources and ensuring the validity and integrity of resources. The specific scheme is as follows:
[0006] In a first aspect, an embodiment of the present application provides a data processing method, the method comprising:
[0007] Determine a first data set including loading paths corresponding to resources in use;
[0008] Determine a second data set including a loading path corresponding to a whitelist resource, wherein the whitelist resource is an indispensable resource;
[0009] For a resource path to be detected, determining whether resources stored in the resource path are redundant resources according to the first data set and the second data set;
[0010] In response to the resource stored in the resource path being a redundant resource, the resource stored in the resource path is cleared.
[0011] In a second aspect, an embodiment of the present application provides a data processing device, the device comprising:
[0012] A first determining unit, configured to determine a first data set including a loading path corresponding to a resource in use;
[0013] A second determining unit, configured to determine a second data set including a loading path corresponding to a whitelist resource, wherein the whitelist resource is an indispensable resource;
[0014] a third determining unit, configured to determine, for a resource path to be detected, whether a resource stored in the resource path is a redundant resource according to the first data set and the second data set;
[0015] The cleaning unit is used to clean up the resources stored in the resource path in response to the resource stored in the resource path being a redundant resource.
[0016] In a third aspect, the present application further provides an electronic device, including:
[0017] Processor; and
[0018] The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the method described in the first aspect is executed.
[0019] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing a data processing program, which is executed by a processor to perform the method described in the first aspect.
[0020] Compared with the prior art, this application has the following advantages:
[0021] The data processing method provided by the embodiment of the present application comprises the following steps: determining a first data set including a loading path corresponding to a resource in use; determining a second data set including a loading path corresponding to a whitelist resource, wherein the whitelist resource is an indispensable resource; for the resource path to be detected, determining whether the resource stored in the resource path is a redundant resource according to the first data set and the second data set; in response to the resource stored in the resource path being a redundant resource, clearing the resource stored in the resource path. In the data processing method provided by the embodiment of the present application, since the first data set includes the loading path of the resource in use, the resource in use is a resource explicitly used in the project, so that the resource whose loading path is located in the first data set does not belong to a redundant resource. Since the second data set includes the loading path of the whitelist resource, the whitelist resource is an indispensable resource in the project, so that the resource whose loading path is located in the second data set does not belong to a redundant resource. In this way, through the first data set and the second data set, the real redundant resources can be accurately and efficiently screened, so as to carry out targeted cleaning of the real redundant resources. It can be seen that the data processing method provided in the embodiment of the present application can improve the cleaning efficiency of redundant resources while reducing the risk of accidental deletion of resources, thereby ensuring the validity and integrity of resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a flow chart of a data processing method provided in an embodiment of the present application;
[0023] Figure 2 It is a flowchart of an example of determining whether a resource stored in a resource path to be detected is a redundant resource in a data processing method provided in an embodiment of the present application;
[0024] Figure 3 It is a schematic diagram of an interface of an example of a resource manager in the data processing method provided in an embodiment of the present application;
[0025] Figure 4 is a structural block diagram of an example of a data processing device provided in an embodiment of the present application;
[0026] Figure 5 It is a structural block diagram of an example of an electronic device for data processing provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0028] It should be noted that the terms "first", "second", "third", etc. in the claims, description and drawings of the present application are used to distinguish similar objects and are not used to describe a specific order or sequence. The data used in this way are interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including", "having" and their variants are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" is merely a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "Including A, B and / or C" means including any one, any two, or any three of A, B, and C.
[0030] It should be understood that in the embodiments of the present application, "B corresponding to A", "B corresponding to A", "A corresponds to B", or "B corresponds to A" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.
[0031] Before describing the implementation methods of the present application in detail, relevant concepts are first introduced, and the prior art is further described.
[0032] As game content is updated and iterated, resource management becomes increasingly important. Resource management not only affects game performance and user experience, but is also directly related to the size of the game package, loading speed, and maintenance costs. The accumulation of redundant resources is a common problem. Redundant resources take up extra space, causing the game package to increase in size, which in turn affects the game startup time and network transmission efficiency.
[0033] Currently, the cleanup of redundant resources mainly relies on the following methods:
[0034] One is that developers rely on personal experience to manually find and delete redundant resources. This method is not only time-consuming, but also prone to missing whitelist resources, resulting in potential functional loss or performance issues.
[0035] The second is to automatically clean up related resources based on the deprecation of functions. For example, if a game activity is removed from the shelves, the corresponding image, audio, or video resources will be deleted. This method is prone to accidentally deleting other non-redundant resources. For example, an image used in a game activity is a resource shared by this game activity and other game activities. When the game activity is removed from the shelves, deleting the image will cause errors in other game activities.
[0036] The third is to develop third-party tools for resource management. Such tools usually require users to follow a series of predetermined steps to complete tasks, such as importing resources, configuring parameters, performing analysis, generating reports, etc. Each step may require specific operations or inputs, which increases the complexity of use, increases the learning cost, and makes resource management too inefficient.
[0037] Fourthly, the number of times the resources are loaded is counted through data collection after the game is launched. When the number of times a resource is loaded is 0 within a period of time, the resource is automatically cleaned up. However, some non-redundant resources may be loaded 0 times within a period of time due to infrequent use. For example, the usage rate of the game manual in the game is usually low, which will cause non-redundant resources to be accidentally deleted.
[0038] Based on the above reasons, in order to improve the cleaning efficiency of redundant resources while reducing the risk of accidental deletion of resources and ensuring the validity and integrity of resources, the first embodiment of the present application provides a data processing method, which is applied to electronic devices. The electronic device can be a desktop computer, a laptop computer, a mobile phone, a tablet computer, an electronic watch, etc., or other electronic devices capable of data processing, which is not specifically limited in the embodiments of the present application.
[0039] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0040] The following, combined Figure 1 to Figure 3 The data processing method provided in the embodiment of the present application is introduced.
[0041] like Figure 1 As shown, the data processing method provided by the present application includes the following steps S101 to S104.
[0042] Step S101: Determine a first data set including loading paths corresponding to resources in use.
[0043] The data processing method provided in the embodiment of the present application can be applied to project development, such as web page development, game project development, etc. In web page development or game project development, the cleaning of redundant resources is involved. In order to introduce the embodiment of the present application more clearly, the embodiment of the present application takes the application of the data processing method to the game project development as an example for explanation, and is not used to limit the application scenario of the data processing method.
[0044] The resources in this embodiment include, but are not limited to, image resources, audio resources, video resources, animation resources, etc. This application does not limit the specific types of resources.
[0045] In this step, resources in use refer to resources that are explicitly used in the project. Such resources are directly used in the project through explicit references or declarations. In other words, resources in use are resources that are explicitly loaded, accessed, or processed during the construction, operation, and display of the project.
[0046] In an optional specific implementation, the loading path corresponding to the resource in use may be obtained according to the configuration of the loading path of the resource in the project, thereby obtaining a first data set including the loading path corresponding to the resource in use.
[0047] As shown in Table 1, it is an example table of loading paths and first data sets corresponding to resources in use in the data processing method provided in an embodiment of the present application.
[0048] Table 1.
[0049]
[0050] In the above Table 1, the resources in use include resource a, resource b, resource c and resource d, among which the loading path of resource a is xx / xx / xx / xx.png, the loading path of resource b is xx / xx / xx / xx.jpg, the loading path of resource c is xx / xx / xx / xx.json, and the loading path of resource d is xx / xx / xx / xx.mp3. Then the first data set is (xx / xx / xx / xx.png, xx / xx / xx / xx.jpg, xx / xx / xx / xx.json, xx / xx / xx / xx.mp3).
[0051] Optionally, the loading paths corresponding to the resources in use contained in the first data set may be stored in a dictionary structure.
[0052] A dictionary is a data structure used to store key-value pairs. Each element in the dictionary has a unique key (Key) corresponding to a value (Value), and the corresponding value can be quickly accessed through the key. The dictionary structure facilitates efficient and fast search of the stored load paths, thereby providing a good basis for determining whether a resource to be detected is a redundant resource in the embodiment of the present application.
[0053] Step S102: Determine a second data set including a loading path corresponding to a whitelist resource, wherein the whitelist resource is an indispensable resource.
[0054] The above whitelist resources refer to the indispensable resources in the project. Whitelist resources are crucial to ensure the normal operation of the project and play a basic supporting role in the life cycle of the project. In actual applications, any accidental deletion, modification or loss of whitelist resources may lead to a damaged user experience and even make the project unable to operate normally.
[0055] Whitelist resources may include but are not limited to one or more of resources used in the past, resources to be used in the future, resources for special operational needs, etc. Whitelist resources are usually pre-set by users (users in this application refer to project developers), and users can modify which resources belong to the whitelist and which no longer belong to the whitelist according to actual needs.
[0056] It should be noted that whitelist resources may include resources that are not in use and / or resources that are in use. Resources in use do not necessarily include all whitelist resources. For example, in order to ensure that players can review normally, resources related to game activities or game seasons that have ended need to be retained, and such resources belong to whitelist resources.
[0057] In an embodiment of the present application, a loading path corresponding to a whitelist resource may be obtained and added to the second data set.
[0058] As shown in Table 2, it is an example table of the loading path and the second data set corresponding to the whitelist resources in the data processing method provided in the embodiment of the present application.
[0059] Table 2.
[0060]
[0061] In Table 1 above, the whitelist resources include resource e, resource f, resource g and resource h, wherein the loading path of resource e is xx / xx / xx / xx.png, the loading path of resource f is xx / xx / xx / xx.jpg, the loading path of resource g is xx / xx / xx / xx.mp3, and the loading path of resource h is xx / xx / xx / xx.fbx, then the second data set is (xx / xx / xx / xx.png, xx / xx / xx / xx.jpg, xx / xx / xx / xx.mp3, xx / xx / xx / xx.fbx).
[0062] Optionally, similar to the above-mentioned first data set, the loading paths corresponding to the resources in use contained in the second data set may also be stored in a dictionary structure.
[0063] In an optional implementation, the above step S102 can be implemented by the following steps:
[0064] Get and parse the preset whitelist file to obtain the loading path corresponding to the whitelist resources;
[0065] The loading path corresponding to the whitelist resource is added to the second data set and stored in a dictionary structure.
[0066] The above-mentioned whitelist file refers to a file storing whitelist resources, or a file storing the loading path of whitelist resources. In an embodiment of the present application, the whitelist file can be read and parsed to obtain the loading path corresponding to the whitelist resource. In this way, the loading path corresponding to the whitelist resource can be added to the second data set and stored in a dictionary structure.
[0067] Step S103: for the resource path to be detected, determine whether the resources stored in the resource path are redundant resources according to the first data set and the second data set;
[0068] There may be one or more resource paths to be detected. This step is used to detect whether the resources stored in each resource path to be detected are redundant resources. In practical applications, detection can be started when a phased task (such as a game season) or a specific project activity (such as a Spring Festival activity) is completed, or detection can be performed according to a preset cycle (such as one week, 10 days, etc.). This application does not specifically limit the timing of detection, and can be set according to the timing requirements.
[0069] For each resource path to be detected, whether the resource path belongs to a redundant resource can be determined based on the first data set containing the loading paths corresponding to the resources in use and the second data set containing the loading paths of the whitelisted resources. Specifically, whether the resource path belongs to a redundant resource can be determined based on whether the first data set and the second data set contain the resource path to be detected.
[0070] In an optional specific implementation, step S103 may include the following steps:
[0071] Finding whether the first data set and the second data set contain a resource path to be detected;
[0072] If the resource path is not included in the first data set and the second data set, it is determined that the resources stored in the resource path are redundant resources.
[0073] Correspondingly, if the first data set and / or the second data set includes the resource path, it is determined that the resources stored in the resource path are non-redundant resources.
[0074] That is, if the first data set includes the resource path, or if the second data set includes the resource path, or if both the first data set and the second data set include the resource path, it is determined that the resources stored in the resource path are non-redundant resources.
[0075] It should be noted that searching whether the first data set contains the resource path to be detected and searching whether the second data set contains the resource path to be detected can be performed either first or simultaneously, and this application does not impose any restrictions on this.
[0076] In one implementation, Figure 2 As shown, it is a flowchart of an example of determining whether the resources stored in the resource path to be detected are redundant resources in the data processing method provided in an embodiment of the present application. Whether the resources stored in the resource path to be detected are redundant resources is determined by sequentially executing the following steps:
[0077] Step S105: receiving a resource path to be detected;
[0078] Step S201: searching whether the resource path to be detected exists in the first data set;
[0079] If the result of executing step S201 is yes, executing step S202a: determining that the resource stored in the resource path is a non-redundant resource;
[0080] If the result of executing step S201 is no, executing step S202b: searching whether the resource path exists in the second data set;
[0081] If the result of executing step S202b is yes, executing step S202a: determining that the resource stored in the resource path is a non-redundant resource;
[0082] If the execution result of step S202b is no, step S203 is executed: determining whether the resource stored in the resource path is a redundant resource.
[0083] In another implementation, determining whether the resource stored in the resource path to be detected is a redundant resource may also be achieved by sequentially executing the following steps:
[0084] Step S105: receiving a resource path to be detected;
[0085] Step S202b: searching whether the resource path to be detected exists in the second data set;
[0086] If the result of executing step S202b is yes, executing step S202a: determining that the resource stored in the resource path is a non-redundant resource;
[0087] If the execution result of step S202b is no, execute step S201: search whether the resource path exists in the first data set;
[0088] If the result of executing step S201 is yes, executing step S202a: determining that the resource stored in the resource path is a non-redundant resource;
[0089] If the execution result of step S201 is no, step S203 is executed: determining whether the resource stored in the resource path is a redundant resource.
[0090] In another implementation, determining whether the resource stored in the resource path to be detected is a redundant resource may also be achieved by sequentially executing the following steps:
[0091] Step S105: receiving a resource path to be detected;
[0092] Step S204: simultaneously searching whether the resource path to be detected exists in the first data set and the second data set;
[0093] If the result of step S204 is no, step S201 is executed: find out whether the resource path exists in the first data set.
[0094] Otherwise, execute step S202a: determine that the resource stored in the resource path is a non-redundant resource.
[0095] In the embodiment of the present application, since the first data set contains the loading path of the resources in use, the resources in use are the resources explicitly used in the project, so if a resource path is in the first data set, it means that the resources stored in the resource path are actually in use and are not redundant resources. Since the second data set contains the loading path of the whitelist resources, the whitelist resources are indispensable resources in the project, so if a resource path is in the second data set, it means that the resources stored in the resource path are indispensable and are not redundant resources.
[0096] In this way, by collecting the loading paths of all resources that are actually used and in use, and combining them with the loading paths of indispensable whitelist resources, truly redundant resources can be screened out.
[0097] Step S104: In response to the resource stored in the resource path being a redundant resource, clearing the resource stored in the resource path.
[0098] When it is determined that the resources stored in the resource path to be detected are redundant resources, the resources stored in the resource path can be cleaned up, thereby cleaning up the real redundant resources to reduce memory usage and improve the loading efficiency of the project application.
[0099] The data processing method provided by the embodiment of the present application comprises the following steps: determining a first data set including a loading path corresponding to a resource in use; determining a second data set including a loading path corresponding to a whitelist resource, wherein the whitelist resource is an indispensable resource; for the resource path to be detected, determining whether the resource stored in the resource path is a redundant resource according to the first data set and the second data set; in response to the resource stored in the resource path being a redundant resource, clearing the resource stored in the resource path. In the data processing method provided by the embodiment of the present application, since the first data set includes the loading path of the resource in use, the resource in use is a resource explicitly used in the project, so that the resource whose loading path is located in the first data set does not belong to a redundant resource. Since the second data set includes the loading path of the whitelist resource, the whitelist resource is an indispensable resource in the project, so that the resource whose loading path is located in the second data set does not belong to a redundant resource. In this way, through the first data set and the second data set, the real redundant resources can be accurately and efficiently screened, so as to carry out targeted cleaning of the real redundant resources. It can be seen that the data processing method provided in the embodiment of the present application can improve the cleaning efficiency of redundant resources while reducing the risk of accidental deletion of resources, thereby ensuring the validity and integrity of resources.
[0100] In an optional implementation, the “cleaning up the resources stored in the resource path” in the above step S104 may include the following steps:
[0101] Add the resource path to a queue to be cleaned up;
[0102] In response to a clearing operation on the queue to be cleared, the resource paths included in the queue to be cleared are cleared.
[0103] In this implementation, when it is determined that the resources stored in a resource path to be detected are redundant resources, the resource path can be added to the queue to be cleaned. After the detection of a batch of resource paths to be detected is completed and the target resource paths in which the resources stored in the batch of resource paths to be detected are redundant resources are added to the queue to be cleaned, the queue to be cleaned can be cleaned up, thereby cleaning up the resources stored in the resource paths contained in the queue to be cleaned up.
[0104] In an embodiment of the present application, a batch script can be created for performing resource cleanup. The above-mentioned cleanup operation can be a trigger operation for the batch script. By executing the commands in the batch script, redundant resources stored in the resource paths included in the cleanup queue can be cleaned up in batches with one click.
[0105] Batch scripts are usually saved with the extension ".bat" or ".cmd". The commands in a batch script are executed sequentially in the operating system. By executing batch scripts, the efficiency of resource cleanup can be effectively improved and repetitive operations can be reduced.
[0106] like Figure 3 As shown, it is a schematic diagram of an interface of an example of a resource manager in a data processing method provided in an embodiment of the present application. The interface of the resource manager includes a control 101 for configuring a resource path to be detected, a control 102 for starting a cleanup batch script, and a control 103 for filling in whitelist resources. The user can trigger controls 101, 102, and 103 respectively to execute corresponding functions, and the triggering operation may include but is not limited to one of a click operation, a press operation, a slide operation, a drag operation, a voice command operation, etc. In response to the triggering operation on control 101, a configuration interface of the resource path to be detected is displayed, so that the user configures the resource path to be detected in the configuration interface; in response to the triggering operation on control 103, a filling interface of whitelist resources is displayed, so that the user fills in the whitelist resources in the filling interface; in response to the triggering operation on control 102, the redundant resources screened are cleaned up with one key.
[0107] By adding resource paths to the queue to be cleaned up, multiple redundant resources can be cleaned up in batches, which improves the efficiency of cleaning up redundant resources.
[0108] In an optional implementation, before the above step S104, the data processing method provided in the embodiment of the present application may further include the following steps:
[0109] In response to a confirmation operation performed on the queue to be cleared, a path to be cleared is determined from resource paths included in the queue to be cleared.
[0110] Accordingly, the step S104 of “cleaning up the resources stored in the resource paths contained in the queue to be cleaned up” may include the following steps:
[0111] The resources stored in the path to be cleaned up are cleaned up.
[0112] In this embodiment, after obtaining the queue to be cleaned, the resource path contained in the queue to be cleaned can be displayed in the version control system, so that the version control system can prompt which resources are to be cleaned. In this way, the user can perform secondary confirmation on the resources to be cleaned to confirm which are truly redundant resources.
[0113] Specifically, the user can perform a confirmation operation on the queue to be cleaned, and the confirmation operation is an operation to confirm which resource paths in the queue to be cleaned contain resources that are real redundant resources. The confirmation operation can be one or more combinations of click operations, drag operations, slide operations, voice command operations, etc. In response to the confirmation operation performed on the queue to be cleaned, the path to be cleaned can be determined from the resource paths contained in the queue to be cleaned, and the path to be cleaned is the path whose contained resources are real redundant resources. In this case, the cleaning operation performed by the user on the queue to be cleaned can actually be an immediate cleaning operation on the path to be cleaned. In response to the cleaning operation on the queue to be cleaned, the real redundant resources stored in the path to be cleaned can be cleaned.
[0114] It should be noted that commonly used version control systems include, but are not limited to, Concurrent Versions System (CVS) version control system, Subversion (SVN) version control system, Vesta version control system, Revision Control System (RCS) version control system, Source Code Control System (SCCS) version control system, etc. Two commonly used tools are CVS version control system and SVN version control system. In the embodiment of the present application, the version control tool adopts SVN version control system.
[0115] The real-time feedback mechanism provided by SVN allows users to reconfirm redundant resources before clearing them, further reducing the risk of accidental deletion of resources and ensuring the validity and integrity of resources.
[0116] In an optional implementation, the above step S101 may include the following steps:
[0117] Determine, according to the configuration mode corresponding to the loading path, a first data set including the loading paths corresponding to the resources in use;
[0118] The configuration method includes at least one of the following: a first method of configuring the loading path through an interface editor, a second method of configuring the loading path through a configuration table, and a third method of configuring the loading path through a code file.
[0119] The data processing method provided in this embodiment can be specifically applied to H5 games. H5 games, also known as HTML5 games, refer to online games developed based on HTML5 technology. H5 games have cross-platform features and can be run on a variety of devices (such as smartphones, tablets, and desktop computers) without relying on a specific operating system or downloading additional clients. H5 games usually use modern Web technologies such as Canvas, WebGL, and JavaScript to provide rich interactive experiences and high-quality graphics effects.
[0120] In an H5 game, the loading path corresponding to the resource in use can be obtained according to the configuration method corresponding to the loading path, thereby obtaining a first data set including the loading path corresponding to the resource in use.
[0121] Specifically, H5 games usually use three configuration methods to configure the loading path of resources, including a first method of configuring the loading path through an interface editor, a second method of configuring the loading path through a configuration table, and a third method of configuring the loading path through a code file.
[0122] The first method of configuring the loading path through the interface editor refers to the method of designing the game interface through graphical operations such as dragging and selecting in the interface editor (also known as the UI editor), and editing the resource paths corresponding to the interface elements (such as controls, pictures, text boxes, etc.). This method can quickly build and adjust the user interface without writing code, which reduces the development threshold and improves design efficiency.
[0123] The second way to configure the load path through the configuration table is to use Excel or other table tools to manage the resource path. Users can define the location, type and other related information of each resource in the table. This method is convenient for batch management and modification of resource paths, especially when there are a large number of similar resources in the project, and the configuration can be completed by simple copy and paste or formula calculation.
[0124] The second method of configuring the loading path through the configuration table and the third method of configuring the loading path through the code file refer to the method of directly writing the resource path in the code. This method is usually suitable for resource paths with complex logic or that need to be dynamically generated. This method can make full use of the capabilities of the programming language to determine the actual location of the resource based on different conditions or runtime states. For example, load images of different resolutions based on the device type, or select a specific audio file based on the results of a network request.
[0125] In this way, based on the configuration method corresponding to the loading path, the loading paths of all resources in use in the project can be fully and accurately covered.
[0126] In an optional implementation manner, when the configuration mode includes the first mode, the second mode, and the third mode, the step of determining the first data set including the loading paths corresponding to the resources in use according to the configuration mode corresponding to the loading paths may include the following steps S301 to S304:
[0127] Step S301: determining a first subset of a first loading path containing a first resource associated with an interface according to an interface file corresponding to the interface editor;
[0128] Step S302: determining, according to the configuration table, a second subset of second loading paths including a second resource associated with the game logic;
[0129] Step S303: determining, according to the code file, a third subset of a third loading path including a third resource written when the code is written;
[0130] Step S304: Integrate the first subset, the second subset and the third subset to obtain a first data set including loading paths corresponding to resources in use.
[0131] In this implementation, the first loading path of the first resource associated with the interface can be obtained according to the interface file corresponding to the interface editor, thereby obtaining a first subset of the first loading path containing the first resource associated with the interface; then, according to the configuration table, the second loading path of the second resource associated with the game logic can be obtained, thereby obtaining a second subset of the second loading path containing the second resource associated with the game logic; then, according to the code file, the third loading path of the third resource written when the code is written can be obtained, thereby obtaining a third subset of the third loading path containing the third resource written when the code is written.
[0132] The interface file corresponding to the interface editor refers to the file created by the visual tool and used to describe the user interface layout and element attributes. The interface file contains the information of all components that constitute the user interface and specifies the location of these components.
[0133] Optionally, the first loading path contained in the first subset may be stored in a dictionary structure, the second loading path contained in the second subset may also be stored in a dictionary structure, and the third loading path contained in the third subset may also be stored in a dictionary structure.
[0134] Since the first subset contains the first loading path of the first resource in use that is associated with the interface, the second subset contains the second loading path of the second resource in use that is associated with the game logic, and the third subset contains the third loading path of the third resource in use that is written when the code is written, in this way, by integrating the first subset, the second subset and the third subset, it is possible to accurately, efficiently and comprehensively obtain a first data set containing the loading paths corresponding to all the resources in use.
[0135] The above steps S301, S302 and S303 are described in detail below:
[0136] In an optional implementation, the above step S301 may include the following steps S401 to S402:
[0137] Step S401: traversing the interface file corresponding to the interface editor, and extracting a first loading path of a first resource associated with the interface from the interface file according to a convention for managing resources configured for the interface editor;
[0138] Step S402: Add the first loading path to a first subset and store it in a dictionary structure.
[0139] In the interface file corresponding to the interface editor, the loading path of the resource usually appears in the definition of each component or element in the form of an attribute. In this implementation, the interface files corresponding to the interface editor can be traversed, the interface files corresponding to the interface editor can be batch scanned, and the first loading path of the first resource associated with the interface can be extracted from the interface file according to the agreed method for managing resources configured for the interface editor.
[0140] Optionally, the convention for managing resources configured for the interface editor may include any one of the following: an interface convention for managing a target interface for the first resource, and a suffix convention for representing a target suffix name for a storage format of the first resource.
[0141] That is, the convention for managing resources configured by the interface editor is either an interface convention for managing the target interface of the first resource, or a suffix convention for the target suffix name representing the storage format of the first resource. These two conventions are used to ensure that the first resource is correctly loaded and used.
[0142] In different agreed ways, the above step S401 has different implementation methods, which can be implemented by any of the following optional implementation methods:
[0143] Optional implementation method 1: When the agreed method for managing resources configured for the interface editor is the interface agreement, obtain the first field containing the agreed target interface from the interface file; parse the first field to obtain the first loading path of the first resource associated with the interface.
[0144] If the interface editor adopts the above interface convention, the first loading path of the first resource can be determined through the above target interface. Specifically, when all interface files are traversed, the first field containing the above target interface can be obtained from the interface file, and the first field can be parsed to obtain the first loading path of the first resource associated with the interface.
[0145] For example, it is agreed to use the "source" interface, then the field with "source" can be found. Assuming that the configuration corresponding to the loading path of picture a set in the interface editor is: source = "resource / assets / icon / 23002.png", then the field "resource / assets / icon / 23002.png" can be found, and the loading path of picture a "resource / assets / icon / 23002.png" can be obtained by parsing the field.
[0146] Optional implementation method two: When the agreed method for managing resources configured for the interface editor is the type of the suffix agreement, obtain a second field containing the agreed target suffix name from the interface file; parse the second field to obtain a first loading path of a first resource associated with the interface.
[0147] If the interface editor adopts the above suffix convention, the first loading path of the first resource can be determined by the above target suffix name. The target suffix name may include ".json", ".png", ".jpg", etc. Specifically, when all interface files are traversed, the second field containing the above target interface agreed upon can be obtained from the interface file, and the second field can be parsed to obtain the second loading path of the first resource associated with the interface.
[0148] For example, if the target suffix is agreed to be ".png", then a field with ".png" can be found. Assuming that the configuration corresponding to the loading path of picture a set in the interface editor is: source = "resource / assets / icon / 23002.png", then the field "resource / assets / icon / 23002.png" can be found, and the loading path of picture a "resource / assets / icon / 23002.png" can be obtained by parsing the field.
[0149] In this way, after obtaining the first loading path of the first resource associated with the interface, the above step S402 can be executed to add the first loading path to the first subset and store it in a dictionary structure to obtain a first dictionary corresponding to the first subset.
[0150] In an optional implementation, the above step S302 may include the following steps S403 to S404:
[0151] Step S403: extracting a second loading path of a second resource associated with the game logic from the configuration table according to the agreed manner for managing resources configured for the configuration table;
[0152] Step S404: Add the second loading path to the second subset and store it in a dictionary structure.
[0153] In this implementation, the configuration table may be loaded, and according to the agreed manner for managing resources configured for the configuration table, the second loading path of the second resource associated with the game logic may be extracted from the configuration table.
[0154] Optionally, the above-mentioned convention method for managing resources configured for the configuration table includes any one of the following: a header convention that stipulates that configuration items with target header identifiers are configuration items corresponding to the loading path, and a suffix convention that stipulates that configuration items with target suffix names are configuration items corresponding to the loading path.
[0155] That is to say, the convention for managing resources configured in the configuration table is either a header convention that stipulates that the configuration item with the target header identifier is the configuration item corresponding to the loading path, or a suffix convention that stipulates that the configuration item with the target suffix name is the configuration item corresponding to the loading path. These two conventions are used to ensure that the first resource is correctly loaded and used.
[0156] In different agreed ways, the above step S403 has different implementation methods, which can be implemented by any of the following optional implementation methods:
[0157] Optional implementation method 1: When the agreed method for managing resources configured for the configuration table is the header agreement, obtain a first configuration item containing the agreed target header identifier from the configuration table; parse the first configuration item to obtain a second loading path for a second resource associated with the game logic.
[0158] If the configuration table adopts the above header convention, the second loading path of the second resource can be determined by the above target header identifier. Specifically, when all configuration tables are loaded, each configuration item of the configuration table can be traversed, and the first configuration item containing the agreed target header identifier can be obtained from the configuration table, and the first configuration item can be parsed to obtain the second loading path of the second resource associated with the game logic.
[0159] For example, when the value of the agreed header "isAssetUrl" is "true", the configuration item includes the resource loading path. When the value of the header "isAssetUrl" is "false", it means that the configuration item does not include the resource loading path, but includes other attribute configurations of the resource (such as layout attributes). Then, you can find the configuration item with the header "isAssetUrl" and the value of "true". Specifically, you can traverse and check the data in the configuration table to obtain the configuration item containing the "isAssetUrl" field and the value of "true", so as to parse the configuration item to obtain the resource loading path.
[0160] Optional implementation method two: when the agreed method for managing resources configured for the configuration table is the suffix agreement, obtain a second configuration item containing the agreed target suffix name from the configuration table; parse the second configuration item to obtain a second loading path for a second resource associated with the game logic.
[0161] If the configuration table adopts the above suffix convention, the second loading path of the second resource can be determined by the above target suffix name. Specifically, when all configuration tables are loaded, each configuration item of the configuration table can be traversed, and the second configuration item containing the agreed target suffix name can be obtained from the configuration table, and the second configuration item is parsed to obtain the second loading path of the second resource associated with the game logic.
[0162] Exemplarily, if the configuration item with the agreed target suffix ".png" includes the resource loading path, the data in the configuration table can be traversed and checked to obtain the configuration item containing the ".png" field, and then the configuration item can be parsed to obtain the resource loading path.
[0163] Thus, after obtaining the second loading path of the second resource associated with the game logic, the above step S404 can be executed to add the second loading path to the second subset and store it in a dictionary structure to obtain a second dictionary corresponding to the second subset.
[0164] In an optional implementation, the above step S303 may include the following steps S405 to S406:
[0165] Step S405: extracting a third loading path of a third resource written when the code is written according to the agreed method for managing resources configured for the code file;
[0166] Step S406: Add the third loading path to the third subset and store it in a dictionary structure.
[0167] In this implementation, the third loading path of the third resource written when the code is written can be extracted from the code file according to the agreed manner for managing resources configured for the code file.
[0168] Optionally, the above-mentioned convention method for managing resources configured for the code file includes any one of the following: a file convention for storing a resource path dictionary containing a third loading path of the third resource in a target file, and a directory convention for storing the third loading path of the third resource in a target directory.
[0169] That is, the convention for managing resources configured for the code file is either a file convention for storing a resource path dictionary containing the third loading path of the third resource in the target file, or a directory convention for storing the third loading path of the third resource in the target directory. These two conventions are used to ensure that the first resource is correctly loaded and used.
[0170] The above file convention refers to storing all hard-coded resource loading paths in a specific target file, making the resource loading path easy to find and update. The above directory convention refers to storing resource loading path files in a specific target directory, making the resource path structure more organized and easy to quickly locate related resources.
[0171] In different agreed ways, the above step S405 has different implementation methods, which can be implemented by any of the following optional implementation methods:
[0172] Optional implementation method 1: when the agreed method for managing resources configured for the code file is the file agreement, extracting the third loading path of the third resource written when the code is written from the agreed target file.
[0173] If the code file adopts the above file convention, the third loading path of the third resource can be determined through the above target file. Specifically, the target file can be loaded, and the third loading path of the third resource written in the code can be extracted from the target file based on the file structure of the target file.
[0174] Optional implementation method 2: when the agreed method for managing resources configured for the code file is the directory agreement, extracting the third loading path of the third resource written when the code is written from the agreed target directory.
[0175] If the code file adopts the above directory convention, the third loading path of the third resource can be determined through the above target directory. Specifically, the target directory can be loaded, and based on the directory naming convention of the target directory, the third loading path of the third resource written when the code is written can be extracted from the target directory.
[0176] Thus, after obtaining the third loading path of the third resource written in the code, the above step S406 can be executed to add the third loading path to the second subset and store it in a dictionary structure to obtain a second dictionary corresponding to the second subset.
[0177] As described above, a first subset including the first loading path of the first resource, a second subset including the second loading path of the second resource, and a third subset including the third loading path of the third resource are obtained.
[0178] Afterwards, the first subset, the second subset and the third subset may be integrated to obtain a first data set. In a specific implementation, the above step S304 may be implemented by the following steps:
[0179] Merging the first subset, the second subset and the third subset to obtain a merged data set;
[0180] The merged data set is deduplicated to obtain a first data set including loading paths corresponding to the resources in use.
[0181] In this implementation, the first subset, the second subset and the third subset may be merged first to obtain a merged data set. In the case where the load paths are stored in dictionary structures respectively, a first dictionary corresponding to the first subset, a second dictionary corresponding to the second subset and a third dictionary corresponding to the third subset are obtained, and the first dictionary, the second dictionary and the third dictionary may be merged to obtain a merged dictionary.
[0182] Afterwards, the merged data set is deduplicated to obtain a first data set including the loading paths corresponding to the resources in use. That is, the merged dictionary is deduplicated to obtain a total dictionary storing the loading paths corresponding to the resources in use.
[0183] The above-mentioned deduplication of the merged data set refers to: for the loading paths of resources that appear more than 1 times in the merged data set, the duplicate loading paths are removed and one loading path is retained. Exemplarily, the loading path of resource a is included in the first subset, the second subset, and the third subset. After the first subset, the second subset, and the third subset are merged, the merged data set obtained includes three loading paths of resource a, and two of them can be removed, and only one loading path of resource a is retained.
[0184] The above is an introduction to the data processing method provided in the embodiment of the present application.
[0185] It can be seen that the data processing method provided in the embodiment of the present application has at least the following advantages:
[0186] 1. Efficiency: Through systematic path collection and automated resource cleanup mechanism, the efficiency of cleaning up redundant resources is significantly improved, and the user's manual operation time is greatly reduced.
[0187] 2. Reliability: The introduced whitelist mechanism effectively avoids the accidental deletion of important resources, ensures the integrity of indispensable whitelist resources, and enhances the stability of the game and user experience.
[0188] 3. User-friendly: The one-key operation interface simplifies the user's operation process, reduces the learning cost, and allows even less experienced users to quickly get started.
[0189] 4. Wide applicability: This solution is not only applicable to a variety of application scenarios, but also has good scalability, can adapt to future resource management needs, and improve the overall resource management level.
[0190] Corresponding to the data processing method provided in the first embodiment of the present application, the second embodiment of the present application further provides a data processing device, such as Figure 4 As shown, the data processing device 400 includes:
[0191] A first determining unit 401 is used to determine a first data set including a loading path corresponding to a resource in use;
[0192] A second determining unit 402 is used to determine a second data set including a loading path corresponding to a whitelist resource, wherein the whitelist resource is an indispensable resource;
[0193] A third determining unit 403 is used to determine, for a resource path to be detected, whether the resources stored in the resource path are redundant resources according to the first data set and the second data set;
[0194] The cleaning unit 404 is configured to clean up the resources stored in the resource path in response to the resource stored in the resource path being a redundant resource.
[0195] Optionally, the third determining unit 403 is specifically configured to:
[0196] Finding whether the first data set and the second data set contain a resource path to be detected;
[0197] If the resource path is not included in the first data set and the second data set, it is determined that the resources stored in the resource path are redundant resources.
[0198] Optionally, the cleaning unit 404 is specifically used for:
[0199] Add the resource path to a queue to be cleaned up;
[0200] In response to a cleanup operation on the queue to be cleaned up, resources stored in the resource paths contained in the queue to be cleaned up are cleaned up.
[0201] Optionally, the data processing device 400 further includes a confirmation unit, and the confirmation unit is used to:
[0202] In response to a confirmation operation performed on the queue to be cleared, determining a path to be cleared from resource paths included in the queue to be cleared;
[0203] The resources stored in the path to be cleaned up are cleaned up.
[0204] Optionally, the first determining unit 401 is specifically configured to:
[0205] Determine, according to the configuration mode corresponding to the loading path, a first data set including the loading paths corresponding to the resources in use;
[0206] The configuration method includes at least one of the following: a first method of configuring the loading path through an interface editor, a second method of configuring the loading path through a configuration table, and a third method of configuring the loading path through a code file.
[0207] Optionally, when the configuration mode includes the first mode, the second mode and the third mode, the first determining unit 401 is specifically configured to:
[0208] Determining, according to the interface file corresponding to the interface editor, a first subset of first loading paths including a first resource associated with the interface;
[0209] Determining, based on the configuration table, a second subset of second load paths containing a second resource associated with the game logic;
[0210] Determine, according to the code file, a third subset of a third loading path including a third resource written when the code is written;
[0211] The first subset, the second subset and the third subset are integrated to obtain a first data set including loading paths corresponding to resources in use.
[0212] Optionally, the first determining unit 401 is specifically configured to:
[0213] Traversing the interface file corresponding to the interface editor, and extracting a first loading path of a first resource associated with the interface from the interface file according to a convention for managing resources configured for the interface editor;
[0214] The first loading path is added to the first subset and stored in a dictionary structure.
[0215] Optionally, the convention for managing resources configured for the interface editor is any one of the following: an interface convention for managing a target interface for the first resource, and a suffix convention for a target suffix name representing a storage format of the first resource.
[0216] Optionally, the first determining unit 401 is specifically configured to:
[0217] In a case where the agreed mode for managing resources configured for the interface editor is the interface agreement, obtaining, from the interface file, a first field containing the agreed target interface;
[0218] The first field is parsed to obtain a first loading path of a first resource associated with the interface.
[0219] Optionally, the first determining unit 401 is specifically configured to:
[0220] In a case where the agreed mode for managing resources configured for the interface editor is the type of the suffix agreement, obtaining a second field containing the agreed target suffix name from the interface file;
[0221] The second field is parsed to obtain a first loading path of a first resource associated with the interface.
[0222] Optionally, the first determining unit 401 is specifically configured to:
[0223] Extracting a second loading path of a second resource associated with the game logic from the configuration table according to the agreed manner for managing resources configured for the configuration table;
[0224] The second loading path is added to the second subset and stored in a dictionary structure.
[0225] Optionally, the agreed method for managing resources configured for the configuration table includes any one of the following: a header agreement that stipulates that configuration items with target header identifiers are configuration items corresponding to the loading path, and a suffix agreement that stipulates that configuration items with target suffix names are configuration items corresponding to the loading path.
[0226] Optionally, the first determining unit 401 is specifically configured to:
[0227] In a case where the agreed manner for managing resources configured for the configuration table is the header agreement, obtaining a first configuration item including the agreed target header identifier from the configuration table;
[0228] The first configuration item is parsed to obtain a second loading path of a second resource associated with the game logic.
[0229] Optionally, the first determining unit 401 is specifically configured to:
[0230] In a case where the agreed manner for managing resources configured for the configuration table is the suffix agreement, obtaining a second configuration item including the agreed target suffix name from the configuration table;
[0231] The second configuration item is parsed to obtain a second loading path of a second resource associated with the game logic.
[0232] Optionally, the first determining unit 401 is specifically configured to:
[0233] Extracting a third loading path of a third resource written when the code is written according to a convention for managing resources configured for the code file;
[0234] The third loading path is added to the third subset and stored in a dictionary structure.
[0235] Optionally, the convention for managing resources configured for the code file includes any one of the following: a file convention for storing a resource path dictionary containing a third loading path of the third resource in a target file, and a directory convention for storing the third loading path of the third resource in a target directory.
[0236] Optionally, the first determining unit 401 is specifically configured to:
[0237] In a case where the agreed manner for managing resources configured for the code file is the file agreement, a third loading path of the third resource written when the code is written is extracted from the agreed target file.
[0238] Optionally, the first determining unit 401 is specifically configured to:
[0239] In a case where the agreed manner for managing resources configured for the code file is the directory agreement, a third loading path of the third resource written when the code is written is extracted from the agreed target directory.
[0240] Optionally, the first determining unit 401 is specifically configured to:
[0241] Merging the first subset, the second subset and the third subset to obtain a merged data set;
[0242] The merged data set is deduplicated to obtain a first data set including loading paths corresponding to the resources in use.
[0243] Optionally, the second determining unit 402 is specifically configured to:
[0244] Get and parse the preset whitelist file to obtain the loading path corresponding to the whitelist resources;
[0245] The loading path corresponding to the whitelist resource is added to the second data set and stored in a dictionary structure.
[0246] Corresponding to the data processing method provided in the first embodiment of the present application, the third embodiment of the present application also provides an electronic device for data processing.
[0247] like Figure 5 , which is a structural block diagram of an example of an electronic device for data processing provided in an embodiment of the present application.
[0248] In this embodiment, an optional hardware structure of the electronic device 500 can be as follows: Figure 5 As shown, it includes: at least one processor 501, at least one memory 502 and at least one communication bus 505; the memory 502 contains a program 503 and data 504.
[0249] The bus 505 may be a communication device for transmitting data between components inside the electronic device 500, such as an internal bus (e.g., a CPU-memory bus, where the processor is a central processing unit, CPU for short), an external bus (e.g., a universal serial bus port, a peripheral component interconnect express port), etc.
[0250] In addition, the electronic device also includes: at least one network interface 506, at least one peripheral interface 507. The network interface 506 provides wired or wireless communication related to an external network 508 (for example, the Internet, an intranet, a local area network, a mobile communication network, etc.); in some embodiments, the network interface 506 may include any number of network interface controllers (NICs), radio frequency (RF) modules, repeaters, transceivers, modems, routers, gateways, any combination of wired network adapters, wireless network adapters, Bluetooth adapters, infrared adapters, near field communication (NFC) adapters, cellular network chips, etc.
[0251] The peripheral interface 507 is used to connect to the peripheral device, and the peripheral device can be the peripheral device 1 ( Figure 5 509), peripheral 2 ( Figure 5 510) and peripheral 3 ( Figure 5 511 in the figure). Peripherals are peripheral devices, which may include but are not limited to cursor control devices (such as mice, touch pads or touch screens), keyboards, displays (such as cathode ray tube displays, liquid crystal displays), displays or light emitting diode displays, video input devices (such as cameras or communication interfaces coupled to video files), etc.
[0252] The processor 501 may be a CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.
[0253] The memory 502 may include a high-speed RAM (full name: Random Access Memory) memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0254] The processor 501 calls the program and data stored in the memory 502 to perform the following steps:
[0255] Determine a first data set including loading paths corresponding to resources in use;
[0256] Determine a second data set including a loading path corresponding to a whitelist resource, wherein the whitelist resource is an indispensable resource;
[0257] For a resource path to be detected, determining whether resources stored in the resource path are redundant resources according to the first data set and the second data set;
[0258] In response to the resource stored in the resource path being a redundant resource, the resource stored in the resource path is cleared.
[0259] Corresponding to the data processing method provided in the first embodiment of the present application, the fourth embodiment of the present application provides a computer-readable storage medium storing a program of the data processing method, which is executed by a processor to perform the following steps:
[0260] Determine a first data set including loading paths corresponding to resources in use;
[0261] Determine a second data set including a loading path corresponding to a whitelist resource, wherein the whitelist resource is an indispensable resource;
[0262] For a resource path to be detected, determining whether resources stored in the resource path are redundant resources according to the first data set and the second data set;
[0263] In response to the resource stored in the resource path being a redundant resource, the resource stored in the resource path is cleared.
[0264] It should be noted that for the detailed description of the devices, electronic devices and computer-readable storage media provided in the second, third and fourth embodiments of the present application, reference can be made to the relevant description of the first embodiment of the present application, and no further details will be given here.
[0265] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
[0266] In a typical configuration, a node device in a blockchain includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0267] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0268] 1. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), random access memory (RAM) of other attributes, read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage media or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.
[0269] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0270] Although the present application is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Determine a first data set including loading paths corresponding to resources in use; Determine a second data set including a loading path corresponding to a whitelist resource, wherein the whitelist resource is an indispensable resource; For a resource path to be detected, determining whether resources stored in the resource path are redundant resources according to the first data set and the second data set; In response to the resource stored in the resource path being a redundant resource, the resource stored in the resource path is cleared.
2. The method according to claim 1, characterized in that The determining, for the resource path to be detected, whether the resources stored in the resource path are redundant resources according to the first data set and the second data set includes: Finding whether the first data set and the second data set contain a resource path to be detected; If the resource path is not included in the first data set and the second data set, it is determined that the resources stored in the resource path are redundant resources.
3. The method according to claim 2, characterized in that The clearing of resources stored in the resource path includes: Add the resource path to a queue to be cleaned up; In response to a cleanup operation on the queue to be cleaned up, resources stored in the resource paths contained in the queue to be cleaned up are cleaned up.
4. The method according to claim 3, characterized in that In response to a cleanup operation on the queue to be cleaned up, before cleaning up resources stored in the resource paths contained in the queue to be cleaned up, the method further includes: In response to a confirmation operation performed on the queue to be cleared, determining a path to be cleared from resource paths included in the queue to be cleared; The clearing of resources stored in the resource path contained in the queue to be cleared includes: The resources stored in the path to be cleaned up are cleaned up.
5. The method according to claim 1, characterized in that The determining of a first data set including a loading path corresponding to the resource in use state comprises: Determine, according to the configuration mode corresponding to the loading path, a first data set including the loading paths corresponding to the resources in use; The configuration method includes at least one of the following: a first method of configuring the loading path through an interface editor, a second method of configuring the loading path through a configuration table, and a third method of configuring the loading path through a code file.
6. The method according to claim 5, characterized in that In the case where the configuration mode includes the first mode, the second mode and the third mode, the determining, according to the configuration mode corresponding to the loading path, a first data set including the loading path corresponding to the resource in use includes: Determining, according to the interface file corresponding to the interface editor, a first subset of first loading paths including a first resource associated with the interface; Determining, based on the configuration table, a second subset of second load paths containing a second resource associated with the game logic; Determine, according to the code file, a third subset of a third loading path including a third resource written when the code is written; The first subset, the second subset and the third subset are integrated to obtain a first data set including loading paths corresponding to resources in use.
7. The method according to claim 6, characterized in that The determining, according to the interface file corresponding to the interface editor, a first subset of first loading paths containing a first resource associated with the interface comprises: Traversing the interface file corresponding to the interface editor, and extracting a first loading path of a first resource associated with the interface from the interface file according to a convention for managing resources configured for the interface editor; The first loading path is added to the first subset and stored in a dictionary structure.
8. The method according to claim 7, characterized in that The convention for managing resources configured for the interface editor is any one of the following: an interface convention for managing a target interface of the first resource, and a suffix convention for representing a target suffix name of a storage format of the first resource.
9. The method according to claim 8, characterized in that The extracting a first loading path of a first resource associated with an interface from the interface file according to a convention for managing resources configured for the interface editor comprises: In a case where the agreed mode for managing resources configured for the interface editor is the interface agreement, obtaining, from the interface file, a first field containing the agreed target interface; The first field is parsed to obtain a first loading path of a first resource associated with the interface.
10. The method according to claim 8, characterized in that The extracting a first loading path of a first resource associated with an interface from the interface file according to a convention for managing resources configured for the interface editor comprises: In a case where the agreed mode for managing resources configured for the interface editor is the type of the suffix agreement, obtaining a second field containing the agreed target suffix name from the interface file; The second field is parsed to obtain a first loading path of a first resource associated with the interface.
11. The method according to claim 6, characterized in that The determining, according to the configuration table, a second subset of second loading paths containing a second resource associated with the game logic comprises: Extracting a second loading path of a second resource associated with the game logic from the configuration table according to the agreed manner for managing resources configured for the configuration table; The second loading path is added to the second subset and stored in a dictionary structure.
12. The method according to claim 11, characterized in that The agreed method for managing resources configured for the configuration table includes any one of the following: a header agreement that stipulates that configuration items with target header identifiers are configuration items corresponding to the loading path, and a suffix agreement that stipulates that configuration items with target suffix names are configuration items corresponding to the loading path.
13. The method according to claim 12, characterized in that The extracting a second loading path of a second resource associated with the game logic from the configuration table according to the agreed manner for managing resources configured for the configuration table includes: In a case where the agreed manner for managing resources configured for the configuration table is the header agreement, obtaining a first configuration item including the agreed target header identifier from the configuration table; The first configuration item is parsed to obtain a second loading path of a second resource associated with the game logic.
14. The method according to claim 12, characterized in that The extracting a second loading path of a second resource associated with the game logic from the configuration table according to the agreed manner for managing resources configured for the configuration table includes: In a case where the agreed manner for managing resources configured for the configuration table is the suffix agreement, obtaining a second configuration item including the agreed target suffix name from the configuration table; The second configuration item is parsed to obtain a second loading path of a second resource associated with the game logic.
15. The method according to claim 6, characterized in that The step of determining, according to the code file, a third subset of the third loading path containing the third resource written when the code is written, comprises: Extracting a third loading path of a third resource written when the code is written according to a convention for managing resources configured for the code file; The third loading path is added to the third subset and stored in a dictionary structure.
16. The method according to claim 15, characterized in that The convention method for managing resources configured for the code file includes any one of the following: a file convention for storing a resource path dictionary containing a third loading path of the third resource in a target file, and a directory convention for storing the third loading path of the third resource in a target directory.
17. The method according to claim 16, characterized in that The extracting, according to the agreed method for managing resources configured for the code file, a third loading path of the third resource written when the code is written, comprises: In a case where the agreed manner for managing resources configured for the code file is the file agreement, a third loading path of the third resource written when the code is written is extracted from the agreed target file.
18. The method according to claim 16, characterized in that The extracting, according to the agreed method for managing resources configured for the code file, a third loading path of the third resource written when the code is written, comprises: In a case where the agreed manner for managing resources configured for the code file is the directory agreement, a third loading path of the third resource written when the code is written is extracted from the agreed target directory.
19. The method according to claim 3, characterized in that The integrating the first subset, the second subset and the third subset to obtain a first data set including loading paths corresponding to resources in use includes: Merging the first subset, the second subset and the third subset to obtain a merged data set; The merged data set is deduplicated to obtain a first data set including loading paths corresponding to the resources in use.
20. The method according to claim 1, characterized in that The determining of the second data set containing the loading path corresponding to the whitelist resource includes: Get and parse the preset whitelist file to obtain the loading path corresponding to the whitelist resources; The loading path corresponding to the whitelist resource is added to the second data set and stored in a dictionary structure.
21. A data processing device, characterized in that: The device comprises: A first determining unit, configured to determine a first data set including a loading path corresponding to a resource in use; A second determining unit, configured to determine a second data set including a loading path corresponding to a whitelist resource, wherein the whitelist resource is an indispensable resource; a third determining unit, configured to determine, for a resource path to be detected, whether a resource stored in the resource path is a redundant resource according to the first data set and the second data set; The cleaning unit is used to clean up the resources stored in the resource path in response to the resource stored in the resource path being a redundant resource.
22. An electronic device, characterized in that: include: processor; as well as The memory is used to store a data processing program. After the electronic device is powered on and the program is run by the processor, the method according to any one of claims 1 to 20 is executed.
23. A computer-readable storage medium, characterized in that: A data processing program is stored, and the program is run by a processor to execute the method according to any one of claims 1 to 20.
Citation Information
Cited By
Game redundant resource cleaning method and system
CN122441110A