File processing method and device, medium and electronic equipment
Patent Information
- Application Number
- CN202211053964.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-31
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2042-08-31
AI Technical Summary
[0002]目前市面上没有此类可以用于处理NeoX引擎复杂数据文件的技术工具,而美术人员在针对XML(Extensible Markup Language,可扩展标记语言)文件进行修改时,常常会直接使用记事本进行修改
[0018] As can be seen from the above technical solutions, the file processing method, file processing apparatus, computer storage medium, and electronic device in the exemplary embodiments of this disclosure have at least the following advantages and positive effects:
Smart Images

Figure CN115408990B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a file processing method and apparatus, a computer-readable storage medium, and an electronic device. Background Technology
[0002] Currently, there are no technical tools available on the market that can be used to process complex data files for the NeoX engine. When artists modify XML (Extensible Markup Language) files, they often directly use Notepad to make changes.
[0003] However, this method of modification only allows editing one file at a time, making it extremely inefficient. Furthermore, Notepad modifications alter the file's encoding, potentially leading to garbled characters or other errors when processing the data file in other programs. There's also the risk of modifying the file structure or syntax; improper modifications can render the file unusable or corrupted. In addition, saving directly using the xml.etree.ElementTree module results in element attributes being arranged on a single line, making data viewing less intuitive. This lack of intuitiveness also makes it impossible to see which fields have been modified after editing with Notepad.
[0004] Therefore, there is an urgent need in this field to develop a new document processing method and apparatus.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] The purpose of this disclosure is to provide a file processing method, file processing apparatus, computer-readable storage medium, and electronic device, thereby overcoming, at least to some extent, the technical problem of the lack of tools for processing data files due to limitations in related technologies.
[0007] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.
[0008] According to a first aspect of the present invention, a file processing method is provided, the method comprising:
[0009] Obtain the target file and identify its encoding format;
[0010] The target file is read using the encoding format to obtain the file content, and a graphical user interface is generated based on the file content;
[0011] When the file content in the graphical user interface is modified, the display method of the file content is adjusted.
[0012] According to a second aspect of the present invention, a document processing apparatus is provided, comprising:
[0013] The file acquisition module is configured to acquire the target file and identify the encoding format of the target file;
[0014] The interface generation module is configured to read the target file using the encoding format to obtain the file content, and generate a graphical user interface based on the file content;
[0015] The display adjustment module is configured to adjust the display method of the file content when the file content in the graphical user interface is modified.
[0016] According to a third aspect of the present invention, an electronic device is provided, comprising: a processor and a memory; wherein the memory stores computer-readable instructions, which, when executed by the processor, implement the file processing method in any of the above exemplary embodiments.
[0017] According to a fourth aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the file processing method in any of the above exemplary embodiments.
[0018] As can be seen from the above technical solutions, the file processing method, file processing apparatus, computer storage medium, and electronic device in the exemplary embodiments of this disclosure have at least the following advantages and positive effects:
[0019] In the methods and apparatus provided by the exemplary embodiments of this disclosure, the file content of the target file is read using an encoding format, providing a file encoding format checking function to ensure file security. Furthermore, a graphical user interface for the target file is generated based on the file content, making the display and modification of the target file more visual and improving the readability and aesthetics of the file content. Even further, adjusting the display method of the modified file content reduces the possibility of errors in file modification, helping users better understand the file content and modification process, and improving the user experience.
[0020] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0022] Figure 1 The illustration shows a schematic diagram of a file editing interface using Notepad in related technologies;
[0023] Figure 2 The illustration schematically shows a flowchart of a file processing method according to an exemplary embodiment of the present disclosure;
[0024] Figure 3 The illustration schematically shows a flowchart of a method for determining a directory file in an exemplary embodiment of the present disclosure;
[0025] Figure 4 The schematic diagram illustrates an interface for selecting the root directory in an exemplary embodiment of this disclosure;
[0026] Figure 5 This schematic diagram illustrates an interface for obtaining a target file in an exemplary embodiment of the present disclosure.
[0027] Figure 6 This schematic diagram illustrates the interface of the file content area in an exemplary embodiment of the present disclosure;
[0028] Figure 7 The illustration shows a flowchart of a method for obtaining file content in an exemplary embodiment of this disclosure;
[0029] Figure 8 The illustration shows a flowchart of a method for reading file content using an encoding format in an exemplary embodiment of the present disclosure;
[0030] Figure 9 The illustration schematically shows a flowchart of a method for generating a graphical user interface based on document content in an exemplary embodiment of the present disclosure;
[0031] Figure 10 The schematic diagram illustrates a flowchart of a method for adjusting the display mode of document content in an exemplary embodiment of this disclosure;
[0032] Figure 11 The schematic diagram illustrates an interface for batch modification in an exemplary embodiment of this disclosure;
[0033] Figure 12 This schematically illustrates an interface diagram for adjusting the display mode in an exemplary embodiment of the present disclosure;
[0034] Figure 13 The illustration shows a flowchart of a method for beautifying document content in an exemplary embodiment of this disclosure;
[0035] Figure 14 This schematic diagram illustrates the structure of a document processing apparatus according to an exemplary embodiment of the present disclosure;
[0036] Figure 15 The illustration schematically depicts an electronic device for implementing a file processing method according to an exemplary embodiment of the present disclosure;
[0037] Figure 16 The illustration schematically depicts a computer-readable storage medium for implementing a file processing method according to an exemplary embodiment of the present disclosure. Detailed Implementation
[0038] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more of the specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0039] The terms “a,” “an,” “the,” and “the” are used in this specification to indicate the presence of one or more elements / components / etc.; the terms “including” and “having” are used to indicate an open-ended inclusion and to mean that there may be other elements / components / etc. in addition to the listed elements / components / etc.; the terms “first” and “second” are used only as markings and are not a limitation on the number of objects.
[0040] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities.
[0041] Currently, there are no such technical tools available on the market that can be used to process complex data files for the NeoX engine.
[0042] The data file can refer to the data file in the NeoX engine, but in this article it specifically refers to the XML class file generated in the NeoX engine.
[0043] XML is a modified version of Standard Generalized Markup Language (SGML). XML-type files are files with the same syntax as XML files, including files with the extensions .gim, .mtl, .sfx, and .xml.
[0044] When artists modify XML files, they often use Notepad directly.
[0045] However, when using this method, only one file can be modified at a time, which is very inefficient.
[0046] Figure 1 The diagram illustrates an interface for modifying files using Notepad in related technologies, such as... Figure 1 As shown, modifying Notepad will change the file's encoding format, which may cause garbled characters or other errors when the data file is processed by other programs. In addition, there is a risk that the file structure or syntax may be modified. If the modification is not done properly, the file may become unusable or the data may be corrupted.
[0047] When saving directly using the xml.etree.ElementTree module, element attributes are arranged in a single line, making the data viewing process less intuitive. This lack of intuitiveness also extends to the fact that after modifying data using Notepad, it's impossible to see which fields have been changed.
[0048] In this article, a module refers to a Python program that includes Python object definitions and Python statements.
[0049] In view of the problems existing in the related technologies, this disclosure proposes a document processing method. Figure 2 A flowchart of the file processing method is shown, such as Figure 2 As shown, the file processing method includes at least the following steps:
[0050] Step S210. Obtain the target file and identify its encoding format.
[0051] Step S220. Read the target file using the encoding format to obtain the file content, and generate a graphical user interface based on the file content.
[0052] Step S230. When the file content in the graphical user interface is modified, adjust the display method of the file content.
[0053] In the exemplary embodiments of this disclosure, the file content of the target file is read using an encoding format, providing a file encoding format checking function to ensure file security. Furthermore, a graphical user interface for the target file is generated based on the file content, making the display and modification of the target file more visual and improving the readability and aesthetics of the file content. Even further, adjusting the display method of the modified file content reduces the possibility of errors in file modification, helping users better understand the file content and modification process, and improving the user experience.
[0054] The following section provides a detailed explanation of each step in the file processing method.
[0055] In step S210, the target file is obtained and its encoding format is identified.
[0056] In an exemplary embodiment of this disclosure, the files to be processed in batches can be selected and filtered before obtaining the target files.
[0057] In an optional embodiment, Figure 3 A flowchart illustrating the method for determining directory files is shown, such as... Figure 3 As shown, the method may include at least the following steps: in step S310, the root directory for batch processing is selected, and the directory files under the root directory are obtained.
[0058] Figure 4 The diagram shows an interface for selecting the root directory, as shown below. Figure 4 As shown, the "Select Root Directory" control allows you to determine the root directory to be processed.
[0059] When the selected root directory exists, iterate through all files under that root directory path to obtain directory files, which can be data files for the NeoX engine. The check for the existence of the root directory can be implemented using an if statement. If the root directory is empty, it indicates that the root directory does not exist; if the root directory is not empty, it indicates that the root directory exists.
[0060] Specifically, the os.walk() method is used to traverse and retrieve directory files. The os.walk() method is a file directory traverser that can iterate through and output the filenames in a directory.
[0061] In step S320, keywords are obtained and used to filter the directory files.
[0062] When passing Figure 4 Enter the keyword you want to filter in the "Keywords" field of the interface shown. This will filter the obtained directory files. Directory files whose filenames do not contain the keyword will be filtered.
[0063] In this exemplary embodiment, if a root directory exists, the directory file for batch processing is obtained, providing a data foundation for batch processing files.
[0064] If the root directory does not exist, the directory files under the root directory path cannot be obtained. Therefore, after obtaining the target file, only the target file can be processed, and batch processing is not performed.
[0065] The target file can be a template file. This template file can be an XML-like file.
[0066] Figure 5 A schematic diagram of the interface for obtaining the target file is shown, such as... Figure 5 As shown, the "Select Template File" control allows you to select a target file containing the content to be modified. Afterward, the contents of the target file can be displayed in the file content area.
[0067] Figure 6 A schematic diagram of the file content area is shown, such as... Figure 6 As shown, if no target file is selected, no content is displayed, only the prompt message "Open file content" appears; if the target file is selected in the file content area, the file content of the target file is displayed.
[0068] After obtaining the target file, the xml.etree.ElementTree module can be used to read the file content of the target file, and then generate the corresponding tags and input boxes based on the read file content.
[0069] In an optional embodiment, Figure 7 A flowchart illustrating the method for obtaining file content is shown, such as... Figure 7 As shown, the method may include at least the following steps: in step S710, the root element of the target file is obtained, and the child elements corresponding to the root element are obtained by traversal.
[0070] Use the parse method in the xml.etree.ElementTree module to read the file content and obtain the tree structure of the target file.
[0071] Further, use the getroot() method to get the root element of the tree structure, and then traverse all child elements under the root element.
[0072] In step S720, the file content of the sub-element is read and formatted.
[0073] In an optional embodiment, the file content includes: attributes, attribute values, depth, and numbering.
[0074] When a root element is passed in, the output will be the name of the root element, its attributes and their values, as well as the depth of the current element.
[0075] For example,<Neo X> The root element has a depth of 0.<Neo X> Below <submesh>(Depth is 1) <sub0>(Depth is 2) are some of the elements.
[0076] The names, such as "name" and "Mtlldx", under the corresponding elements are the names, which are also the attributes. The corresponding attributes, such as "Sphere01" and "0", are the attribute values.
[0077] Here, the attribute and attribute value refer to being stored in the form of a key-value database. Key-value pairs are a data storage paradigm designed to store, retrieve, and manage associative arrays. They typically consist of keys and values, with a one-to-one correspondence between keys and values.
[0078] When an element is read, it can be numbered. Whenever an element with the same name appears, its number can be incremented by one to obtain the final number.
[0079] Furthermore, the file content of the child elements is formatted.
[0080] Formatting each read element can be done by removing spaces from the attribute values of that element.
[0081] Each element is a dictionary, with a one-to-one correspondence between its attributes and their corresponding values. A dictionary is a mutable container model that can store objects of any type. In this case, the dictionary consists of key-value pairs.
[0082] After obtaining each attribute, modify each corresponding attribute value. If the attribute value contains spaces, it may cause a formatting error, so you can remove the spaces.
[0083] In this exemplary embodiment, the file content corresponding to the target file is read, providing a data foundation and theoretical support for the subsequent generation of a graphical user interface and the enhancement of the file content.
[0084] The encoding format of the target file can be read using the chardet function, but it can also be read in other ways. This exemplary embodiment does not impose any special limitations on this.
[0085] In step S220, the target file is read using an encoding format to obtain the file content, and a graphical user interface is generated based on the file content.
[0086] In an exemplary embodiment of this disclosure, after obtaining the encoding format of the target file, the file content of the target file can be read according to the encoding format.
[0087] Figure 8 A flowchart illustrating a method for reading file content using an encoding format is shown, such as... Figure 8 As shown, the method may include at least the following steps: In step S810, when the encoding format is the first format, the encoding format is transcoded to obtain the second format, and the target file of the second format is read to obtain the file content.
[0088] The first format can be GBK (Chinese Internal Code Specification), GB2312 (Information Interchange Chinese Coded Character Set), or GB18030 (Information Technology--Chinese coded character set). GBK encoding is backward compatible with GB2312 encoding, while GB18030 encoding is backward compatible with GBK encoding.
[0089] In this context, backward compatibility means that not only are the characters compatible, but the encodings of compatible characters are also the same.
[0090] GBK encoding can already represent the vast majority of Chinese characters in daily life (a total of 20,902, including traditional characters), so GB18030 can also be treated as GBK.
[0091] Furthermore, the encoding format is determined.
[0092] The second format can be UTF-8 or ASCII. When the encoding format is not the second format of UTF-8 (Universal Character Set / Unicode Transformation Format, 8-bit, a variable-length character encoding) or ASCII (American Standard Code for Information Interchange), it can be checked again whether the encoding format is the first format of GBK encoding. When the encoding format is neither the first nor the second format, no processing is required for that encoding format.
[0093] When the encoding format is any one of GBK, GB2312 and GB18030, the encoding format can be converted using a transcoding function.
[0094] The file content is obtained by reading the file content using encoding_format (GBK) and writing it back to the file content using utf-8 encoding.
[0095] In step S820, when the encoding format is the second format, the target file in the second format is read to obtain the file content.
[0096] When the encoding format is UTF-8 or ASCII, there is no need to convert the encoding format of the target file. The file content can be obtained by directly writing the file content using the UTF-8 encoding format.
[0097] In this exemplary embodiment, the encoding format of the target file is either transcoded or left unprocessed to obtain file content with a uniform encoding format, thus ensuring the security of the file content and the correctness of the graphical user interface display.
[0098] Once the file content is read, a graphical user interface can be automatically generated based on the file content.
[0099] In an optional embodiment, when a previous graphical user interface has been generated, the previous graphical user interface is cleared, and a new graphical user interface is generated based on the file content.
[0100] When the file content area contains displayed content, the content of the graphical user interface can be read and deleted one by one.
[0101] When the file content area is empty, a graphical user interface can be generated based on the read file content.
[0102] Figure 9 A flowchart illustrating a method for generating a graphical user interface based on file content is shown, such as... Figure 9 As shown, the method may include at least the following steps: In step S910, the display position of the attribute and the attribute value is determined according to the depth and number, and an input box for the attribute value is generated; the input box indicates that the attribute value can be modified.
[0103] Retrieve each node_info element and its depth to generate the corresponding tag and attribute. Additionally, generate the corresponding text (an element in the target file consists of a tag, attribute, and text).
[0104] In this case, the tag and text are on the same line, and the attribute is on the next line. Therefore, after generating the tag and text, the sort value can be incremented by 1 to ensure that the attribute is displayed in the correct position.
[0105] Specifically, when determining the display position of attributes and attribute values based on depth and number, depth can be used as a right-shift parameter and number as a down-shift parameter, with the number value incremented by 1.
[0106] For example, text is a description <sub0>Statements are generally displayed in <sub0>The right side. Since the NeoX engine does not require displaying text, it does not need to read or display the text. However, when displaying it, the text needs to be... <sub0>There is a space between them, so the rightward shift of text can be deep+3.
[0107] Since an attribute is a key-value pair (key-var), representing an attribute and its value, the key is generated first, followed by the var, and both are ensured to be on the same line. Because the key is immutable, a label can be generated, and the var, representing the modifiable part, can be generated as an entry, indicating that the attribute value within the entry can be modified.
[0108] In step S920, attributes and attribute values are displayed according to their display positions, and input boxes are displayed to obtain a graphical user interface.
[0109] After determining the display location and generating the input box, you can display the attributes and attribute values according to the display location, and display the input box corresponding to the attribute value to obtain a graphical user interface.
[0110] In this exemplary embodiment, a method for generating a graphical user interface that displays file content is provided. Visualization limits the scope of modification of the file content, preventing modification of the syntax structure of the target file and further ensuring the security of the target file.
[0111] In step S230, when the file content in the graphical user interface is modified, the display method of the file content is adjusted.
[0112] In an exemplary embodiment of this disclosure, after generating a graphical user interface, the file content of the target file can be modified visually, and intuitive modification prompts are provided for the modified content.
[0113] In an optional embodiment, Figure 10 A flowchart illustrating the method for adjusting the display of file content is shown, such as... Figure 10 As shown, the method may include at least the following steps: In step S1010, when the file content in the graphical user interface is modified, the target file and the filtered directory file are modified in batches according to the modified file content.
[0114] Figure 11 A schematic diagram of the interface for batch modifications is shown, such as... Figure 11 As shown, when the file content in the graphical user interface is modified, clicking the "Start" control allows for batch modification of the target file and directory files containing the modified content.
[0115] The batch modification process is entirely controlled by the program, modifying only the corresponding fields while leaving the rest untouched, thus maximizing data security.
[0116] In step S1020, the display method of the modified file content is adjusted.
[0117] Bind the CheckDynamicEntry event function when adjusting the display mode.
[0118] When the content of the file in the input box is modified, the modified content can be compared with the original content in the input box. When the comparison result shows that the modified content is different from the original content, the background color of the input box can be set to red. Alternatively, other colors can be used, or other differentiated display methods can be provided; this exemplary embodiment does not impose any special limitations on this.
[0119] Figure 12 A schematic diagram of the interface for adjusting the display mode is shown, such as... Figure 12 As shown, when the file content in the input box corresponding to CompatibleMask is modified, the background color of the input box is adjusted to a different color than white for distinguishing display.
[0120] In this exemplary embodiment, by adjusting the display method of the modified file content, it is possible to provide prompts for the modified fields, so that developers can more intuitively understand the modified parts and content.
[0121] Furthermore, the content of the file to be saved can be beautified after modifying the attribute (key-var) of the corresponding element.
[0122] In an optional embodiment, Figure 13 The flowchart illustrates a method for enhancing the content of a document, such as... Figure 13 As shown, the method may include at least the following steps: in step S1310, the modified file content is read, and the modified file content is matched using regular expressions to obtain a matching result.
[0123] Read the saved file content as a file.
[0124] Use this regular expression to read the file content line by line and match the file content within <>.
[0125] During matching, the reading position starts with "<" and ends with ">" or a space. ".*?" indicates that as few characters as possible should be read between the specified start and end points.
[0126] In step S1320, the modified file content is lined up according to the matching result.
[0127] When the matching result represents the first scenario, it could be a match for version information (e.g., `<?xml version=......>`). This scenario doesn't require any embellishment. Therefore, a normal line break is sufficient when the version information ends.
[0128] When the matching result represents the second case, it can be the end of a matched element. Since there is no other content in the end symbol, no special processing is needed; a normal line break is sufficient.
[0129] In step S1330, the modified file content is line-wrapped and aligned according to the matching results.
[0130] When the matching result represents the third case, it can represent the beginning of an element. <tag>.
[0131] In files saved using the official module, attribute information will be placed in... <tag>Furthermore, since two attributes are separated by spaces, simply replace the spaces with \n to create a newline. In addition, a tab character \t needs to be inserted before each attribute, equal to the depth of its corresponding element plus one, to align the file content.
[0132] In this exemplary embodiment, the method of matching and adjusting the display of file content using regular expressions ensures that the modified file content is formatted correctly and aesthetically pleasing, making it more convenient for subsequent viewing and use.
[0133] When a tool is provided to perform file processing functions, the "Select Root Directory" control allows the user to determine the root directory to be processed.
[0134] By entering the keywords to be filtered in the "Keywords" field of the interface, you can filter the obtained directory files.
[0135] The "Select Template File" control allows you to select a target file that contains the content to be modified.
[0136] When the file content area is empty, a graphical user interface can be generated based on the read file content.
[0137] When the contents of a file in the graphical user interface are modified, clicking the "Start" control allows for batch modification of the target file and directory files containing the modified content.
[0138] In the exemplary embodiments of this disclosure, the file content of the target file is read using an encoding format, providing a file encoding format checking function to ensure file security. Furthermore, a graphical user interface for the target file is generated based on the file content, making the display and modification of the target file more visual and improving the readability and aesthetics of the file content. Even further, adjusting the display method of the modified file content reduces the possibility of errors in file modification, helping users better understand the file content and modification process, and improving the user experience.
[0139] Furthermore, in an exemplary embodiment of this disclosure, a document processing apparatus is also provided. Figure 14 A schematic diagram of the document processing device is shown, such as... Figure 14 As shown, the file processing device 1400 may include: a file acquisition module 1410, an interface generation module 1420, and a display adjustment module 1430. Wherein:
[0140] The file acquisition module 1410 is configured to acquire a target file and identify the encoding format of the target file;
[0141] The interface generation module 1420 is configured to read the target file using the encoding format to obtain file content, and generate a graphical user interface based on the file content;
[0142] The adjustment display module 1430 is configured to adjust the display mode of the file content when the file content in the graphical user interface is modified.
[0143] In an exemplary embodiment of the present invention, before obtaining the target file, the method further includes:
[0144] Select the root directory for batch processing and obtain the directory files under the root directory;
[0145] Obtain keywords and use the keywords to filter the directory files.
[0146] In an exemplary embodiment of the present invention, adjusting the display mode of the file content when the file content in the graphical user interface is modified includes:
[0147] When the file content in the graphical user interface is modified, the target file and the filtered directory file are modified in batches according to the modified file content.
[0148] Adjust the display method of the modified file content.
[0149] In an exemplary embodiment of the present invention, after obtaining the target file, the method further includes:
[0150] Obtain the root element of the target file, and then iterate through the file to obtain the child elements corresponding to the root element.
[0151] Read the file content of the child element and format the file content of the child element.
[0152] In one exemplary embodiment of the present invention, the file content includes: attributes, attribute values, depth, and number.
[0153] In an exemplary embodiment of the present invention, generating a graphical user interface based on the file content includes:
[0154] The display positions of the attribute and the attribute value are determined based on the depth and the number, and an input box for the attribute value is generated; the input box indicates that the attribute value can be modified.
[0155] The attribute and its value are displayed at the specified display location, and the input box is also displayed to obtain a graphical user interface.
[0156] In an exemplary embodiment of the present invention, generating a graphical user interface based on the file content includes:
[0157] When a previous graphical user interface has been generated, the previous graphical user interface is cleared, and a new graphical user interface is generated based on the file content.
[0158] In an exemplary embodiment of the present invention, the step of reading the target file using the encoding format to obtain file content includes:
[0159] When the encoding format is the first format, the encoding format is transcoded to obtain the second format, and the target file in the second format is read to obtain the file content;
[0160] When the encoding format is the second format, the target file in the second format is read to obtain the file content.
[0161] In an exemplary embodiment of the present invention, after adjusting the display mode of the file content, the method further includes:
[0162] Read the modified file content and use regular expressions to match the modified file content to obtain the matching result;
[0163] The modified file content is then updated with newlines based on the matching results; or
[0164] The modified file content is then line-wrapped and aligned based on the matching results.
[0165] The specific details of the aforementioned file processing device 1400 have been described in detail in the corresponding file processing method, so they will not be repeated here.
[0166] It should be noted that although several modules or units of the document processing apparatus 1400 have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0167] Furthermore, in an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.
[0168] The following reference Figure 15 To describe an electronic device 1500 according to such an embodiment of the present invention. Figure 15 The electronic device 1500 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0169] like Figure 15 As shown, the electronic device 1500 is manifested in the form of a general-purpose computing device. The components of the electronic device 1500 may include, but are not limited to: at least one processing unit 1510, at least one storage unit 1520, a bus 1530 connecting different system components (including storage unit 1520 and processing unit 1510), and a display unit 1540.
[0170] The storage unit stores program code that can be executed by the processing unit 1510, causing the processing unit 1510 to perform the steps described in the "Exemplary Methods" section above, according to various exemplary embodiments of the present invention.
[0171] Storage unit 1520 may include readable media in the form of volatile storage units, such as random access memory (RAM) 1521 and / or cache memory 1522, and may further include read-only memory (ROM) 1523.
[0172] Storage unit 1520 may also include a program / utility 1524 having a set (at least one) program module 1525, such program module 1525 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0173] Bus 1530 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0174] Electronic device 1500 can also communicate with one or more external devices 1700 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with electronic device 1500, and / or any device that enables electronic device 1500 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 1550. Furthermore, electronic device 1500 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 1560. As shown, network adapter 1560 communicates with other modules of electronic device 1500 via bus 1530. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 1500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0175] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0176] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the invention described in the "Exemplary Methods" section above.
[0177] refer to Figure 16 As shown, a program product 1600 for implementing the above-described method according to an embodiment of the present invention is described. It may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0178] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0179] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0180] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0181] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0182] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.< / tag> < / tag> < / submesh>
Claims
1. A file processing method, characterized in that, The method includes: Select the root directory for batch processing and obtain the directory files under the root directory; Obtain keywords and use the keywords to filter the directory files; Obtain the target file and identify its encoding format; The target file is read using the encoding format to obtain file content, and a graphical user interface is generated based on the file content. The file content includes attributes, attribute values, depth, and a number. Generating the graphical user interface based on the file content includes: determining the display positions of the attributes and attribute values based on the depth and the number, and generating an input box for the attribute value; the input box indicates that the attribute value is modifiable; displaying the attributes and attribute values according to the display positions, and displaying the input box corresponding to the attribute value, to obtain the graphical user interface. When the file content in the graphical user interface is modified, the target file and the filtered directory files are modified in batches according to the modified file content, and the display mode of the modified file content is adjusted.
2. The file processing method according to claim 1, characterized in that, After obtaining the target file, the method further includes: Obtain the root element of the target file, and then iterate through the file to obtain the child elements corresponding to the root element. Read the file content of the child element and format the file content of the child element.
3. The file processing method according to claim 1, characterized in that, The step of generating a graphical user interface based on the file content includes: When a previous graphical user interface has been generated, the previous graphical user interface is cleared, and a new graphical user interface is generated based on the file content.
4. The file processing method according to claim 1, characterized in that, The step of reading the target file using the encoding format to obtain the file content includes: When the encoding format is the first format, the encoding format is transcoded to obtain the second format, and the target file in the second format is read to obtain the file content; When the encoding format is the second format, the target file in the second format is read to obtain the file content.
5. The file processing method according to claim 1, characterized in that, After adjusting the display method of the file content, the method further includes: Read the modified file content and use regular expressions to match the modified file content to obtain the matching result; The modified file content is then updated with newlines based on the matching results; or The modified file content is then line-wrapped and aligned based on the matching results.
6. A document processing device, characterized in that, include: The file acquisition module is configured to select the root directory for batch processing and acquire the directory files under the root directory; Obtain keywords and use the keywords to filter the directory files; obtain target files and identify the encoding format of the target files; The interface generation module is configured to read the target file using the encoding format to obtain file content, and generate a graphical user interface based on the file content; wherein, the file content includes: attributes, attribute values, depth, and number; generating the graphical user interface based on the file content includes: determining the display position of the attributes and attribute values based on the depth and the number, and generating an input box for the attribute values; the input box indicates that the attribute values can be modified; displaying the attributes and attribute values according to the display positions, and displaying the input box corresponding to the attribute values, to obtain the graphical user interface; The display adjustment module is configured to, when the file content in the graphical user interface is modified, batch modify the target file and the filtered directory files according to the modified file content, and adjust the display mode of the modified file content.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the file processing method according to any one of claims 1-5.
8. An electronic device, characterized in that, include: processor; Memory for storing the executable instructions of the processor; The processor is configured to execute the file processing method of any one of claims 1-5 by executing the executable instructions.
Citation Information
Patent Citations
Resource batch processing method and device, electronic equipment and storage medium
CN111400244A
Method to Automatically Display Filenames Encoded in Multiple Code Sets
US20120137218A1