A method and system for upgrading VB.NET code
Patent Information
- Application Number
- CN202211284620.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-19
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2042-10-19
AI Technical Summary
且人工作业的过程中,极容易出现单纯miss,或受限于开发者经验,导致同样的问题,出现了不一样的修改方案
[0014]本发明的有益效果是:本发明提供的一种升级VB.NET代码的方法及系统,基于传统的升级方式很容易出现对应遗漏,对应方案不统一甚至错误的情况,且需要人工逐一对文件进行代码的修改,效率不高,且正确性,一致性无法得到较好的保证。
Smart Images

Figure CN115599418B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer software technology, and more specifically to a method and system for upgrading VB.NET code. Background Technology
[0002] Upgrading from VB6 to VB.NET typically involves an initial upgrade using an older version of Visual Studio (VS2008), followed by a second upgrade using a newer version (VS2019). Code Advisor is then used to analyze and annotate the results of the second upgrade. Finally, the processed code is manually upgraded.
[0003] During the manual upgrade phase, many errors still need to be corrected one by one, including a large number of known, similar error codes that conform to certain rules. Furthermore, manual work is prone to simple misses or limitations imposed by the developer's experience, leading to different solutions for the same problem. This repetitive work wastes the developer's time and energy, while different solutions for the same problem hinders future batch updates. Summary of the Invention
[0004] This invention addresses one of the technical problems existing in the prior art by providing a method and system for upgrading VB.NET code.
[0005] The technical solution of this invention to solve the above-mentioned technical problems is as follows: a method for upgrading VB.NET code. It includes the following steps: S1. Use the upgraded VB.NET code from VS as input data, and set code modification rules and code analysis rules; S2. Select the code execution item, select or filter the code location to be executed, and then back up the source code and select to execute the code modification program or the code analysis program for batch modification and batch analysis. S3. Predict the results based on the selected code execution items and output a code execution report; S4. After confirming that everything is correct, output the final code and the final execution report.
[0006] Based on the above technical solution, the present invention can also be improved as follows.
[0007] Optionally, in step S2, when selecting or filtering the code location to be executed, the location is determined based on keywords, and the search is performed based on the different positions and functions of the keywords in the code, and the filtered results are output based on the category search.
[0008] Optionally, categorized retrieval includes combining keywords in different scenarios or keywords located in different positions in the code, as well as simultaneously retrieving multiple keywords.
[0009] Optionally, in step S2, the code modification program includes modifying the code using known modification rules and modifying the code using newly added modification rules; the code analysis program includes analyzing the code using known analysis rules and analyzing the code using newly added analysis rules; and the code modification program and the code analysis program are displayed in the form of a list or keywords for selection.
[0010] Optionally, the code modifier may include regular expressions and replacement text.
[0011] Optionally, the code modification program and code analysis program support online editing of rules, and execution of code execution items after modification based on the selected known modification rules or known analysis rules. The modified rules are stored as new known modification rules or known analysis rules, and the keywords are redefined for future selection; or the code of the modification rules or analysis rules can be imported through storage media.
[0012] Optionally, the code execution report displays the modifications made to the corresponding files after the selected modification or analysis rules are executed, as well as suggested modifications, marked problematic code, and the code path, line number, and problem description.
[0013] According to a second aspect of the present invention, a system for upgrading VB.NET code is provided, the system employing any of the methods for upgrading VB.NET code described above.
[0014] The beneficial effects of the present invention are: The method and system for upgrading VB.NET code provided by the present invention are much more efficient than traditional upgrade methods, which are prone to omissions, inconsistent solutions or even errors. In addition, manual modification of the code in each file is required, which is inefficient and cannot guarantee correctness and consistency.
[0015] The technical solution of this invention can iterate the development experience of each VB6 to VB.NET upgrade project, changing a large amount of repetitive work from manual to machine work, ensuring the uniformity of modification schemes, improving the accuracy of modifications, promoting the uniformity of code style, and freeing personnel from repetitive work so that they can devote themselves to more valuable problem investigation and experience iteration.
[0016] The time saved can be used to investigate and summarize new problems that arise during project upgrades, which can lead to the formulation of new rules, thus forming a virtuous cycle. This greatly promotes the productivity improvement of such projects, the improvement of the quality of deliverables, and the reuse of development experience, while minimizing the workload of manual operations. Attached Figure Description
[0017] Figure 1 This is a schematic diagram illustrating the steps of a method and system for upgrading VB.NET code according to the present invention.
[0018] Figure 2 This is a schematic diagram illustrating the operation flow of a method and system for upgrading VB.NET code according to the present invention. Detailed Implementation
[0019] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and are not intended to limit the scope of the invention.
[0020] In the description of this invention, unless otherwise specified and limited, it should be noted that the terms "installation", "connection" and "linking" should be interpreted broadly. For example, they can refer to mechanical or electrical connections, or internal connections between two components. They can be direct connections or indirect connections through an intermediate medium. Those skilled in the art can understand the specific meaning of the above terms according to the specific circumstances.
[0021] like Figure 1 and Figure 2 As shown, this embodiment discloses a method for upgrading VB.NET code, which includes the following steps: S1. Use the upgraded VB.NET code from VS as input data, and set code modification rules and code analysis rules; S2. Select the code execution item, select or filter the code location to be executed, and then back up the source code and select to execute the code modification program or the code analysis program for batch modification and batch analysis. S3. Predict the results based on the selected code execution items and output a code execution report; S4. After confirming that everything is correct, output the final code and the final execution report.
[0022] It is understandable that the technical solution adopted in this embodiment is based on traditional upgrade methods, which are prone to omissions, inconsistent solutions or even errors. In addition, it requires manual modification of the code of each file, which is inefficient and cannot guarantee correctness and consistency.
[0023] The technical solution of this invention can iterate the development experience of each VB6 to VB.NET upgrade project, changing a large amount of repetitive work from manual to machine work, ensuring the uniformity of modification schemes, improving the accuracy of modifications, promoting the uniformity of code style, and freeing personnel from repetitive work so that they can devote themselves to more valuable problem investigation and experience iteration.
[0024] The time saved can be used to investigate and summarize new problems that arise during project upgrades, which can lead to the formulation of new rules, thus forming a virtuous cycle. This greatly promotes the productivity improvement of such projects, the improvement of the quality of deliverables, and the reuse of development experience, while minimizing the workload of manual operations.
[0025] Specifically, in this embodiment, VB.NET code upgraded based on VS is used as input data for code modification or analysis. Code modification or analysis is performed according to predefined code modification and analysis rules, provided that the code locations to be checked are identified. The predefined code modification or analysis rules are then executed to identify problems in the upgraded code, and a code execution report is output for user review and verification. If further modification or analysis is needed, the corresponding program can be executed again until the final result is determined. A final execution report is then output for archiving and later analysis.
[0026] In one alternative embodiment, in step S2, when selecting or filtering the code location to be executed, the location is determined based on keywords, and the search is performed based on the different positions and functions of the keywords in the code, and the filtered results are output based on the category search.
[0027] It is understandable that in this embodiment, the code to be executed is filtered and determined based on specific keywords, and categorized and retrieved based on the location of the keywords in the code or their corresponding functions, which can be understood as corresponding to different scenarios. Code modification and code analysis have their own rules. The purpose of code modification is to replace code in a targeted manner according to the rules, eliminating bugs, non-standard coding practices, and other problems in the code. The purpose of code analysis is to perform keyword retrieval according to the rules, extracting the files, line numbers, and content of code related to the keywords. Convenient output of the number of specified analysis points, the scope of influence, and other conclusions facilitates users in determining subsequent processing solutions.
[0028] In one alternative embodiment, the categorized retrieval includes combining keywords from different scenarios or keywords located in different positions in the code, as well as simultaneously retrieving multiple keywords.
[0029] It is understood that, in this embodiment, in addition to keywords, the rule entry provides additional conditions that can be combined, such as whether the keyword must appear at the beginning or end of the line, whether it is case-sensitive, and the type of file in which it is located.
[0030] In one optional embodiment, in step S2, the code modification program includes modifying the code using known modification rules and modifying the code using newly added modification rules; the code analysis program includes analyzing the code using known analysis rules and analyzing the code using newly added analysis rules; and the code modification program and the code analysis program are displayed in the form of a list or keywords for selection. The code modification program includes regular expressions and replacement text.
[0031] Whether using code modification or code analysis features, rule filtering is required. Users can specify particular rules to execute or add custom rules before execution. If no suitable solution is found among the existing rules, new rules can be entered through the rule addition interface.
[0032] When adding a rule to modify code, you need to enter the keywords used for searching when executing the rule, as well as the modification scheme (i.e., the code to be replaced). Regular expressions or simple text replacement can be used. The rule input should consider various possible phenomena during replacement, and should comprehensively consider which keywords to use to query the modified objects.
[0033] Adding rules for code analysis is similar to adding rules for code modification, but the difference is that you need to provide additional basic result classifications and judgment criteria. This is used to pre-define the scenarios and conclusions for the code containing the keyword. For example, if the keyword is in a comment, the result classification is "no impact," and the judgment criterion is that the line begins with a comment symbol; if the keyword appears in a method name, the result classification is "confirmation of object," and the judgment criterion is that the line containing the keyword begins with the keyword defined in the method (Function, Sub); if the keyword appears in an assignment statement, the result classification is "potential for a bug," and the judgment criterion is that an equals sign follows the keyword, etc. The analysis report output will be categorized and statistically analyzed based on the user-preset scenarios.
[0034] In one alternative embodiment, the code modification program and the code analysis program support online editing of rules, and execution of code execution items after modification according to selected known modification rules or known analysis rules. The modified rules are stored as new known modification rules or known analysis rules, and keywords are redefined for future selection. Alternatively, the code of the modification rules or analysis rules can be imported through a storage medium.
[0035] It is understandable that in this embodiment, whether analyzing or modifying rules, in addition to setting simple rules through the rule entry interface, it can also be extended by writing or replacing check code, making the application scenarios more flexible.
[0036] In one alternative embodiment, the code execution report displays the modifications made to the corresponding file after the selected modification or analysis rules were executed, as well as suggested modifications, marked problematic code, and the code path, line number, and problem description.
[0037] Understandably, the final output report includes both summary conclusions and conclusions that correspond one-to-one with the rules selected by the user.
[0038] In another embodiment, a system for upgrading VB.NET code is provided, which employs any of the methods for upgrading VB.NET code described above.
[0039] Understandably, in this system, based on VB.NET code upgraded via VS as input data, the user first selects a function, choosing between code modification or code analysis. If code modification is selected, the code modification interface opens for rule filtering, allowing the user to choose existing rules or add new ones. The selected rules are then executed, generating an execution report, and finally, a code modification report is output. If code analysis is selected, the code analysis interface opens for rule filtering, allowing the user to choose existing rules or add new ones. After logging in with the new rule, the user returns to the rule filtering interface to select rules again. If adding a rule is required, the program performs user authentication to verify the user's permission to add rules, then continues selecting and executing the chosen rules. Finally, either a code modification report or a code analysis report is output.
[0040] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied 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.
[0041] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0042] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0043] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0044] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0045] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for upgrading VB.NET code, characterized in that, It includes the following steps: S1. Use the upgraded VB.NET code from VS as input data, and set code modification rules and code analysis rules; S2. Select the code execution item, select or filter the code location to be executed, and then back up the source code and select to execute the code modification program or the code analysis program for batch modification and batch analysis. In step S2, the code modification program includes modifying the code using known modification rules and modifying the code using newly added modification rules; the code analysis program includes analyzing the code using known analysis rules and analyzing the code using newly added analysis rules; and the code modification program and the code analysis program are displayed in the form of a list or keywords for selection. When adding code analysis rules, you need to provide basic result classification and judgment criteria to pre-set the scenario and conclusion of the code where the keyword is located. If the keyword exists in the comments, the result classification has no effect. The judgment criterion is that the line starts with the comment symbol. If a keyword appears in a method name, the result category is "outside of confirmed objects," and the determination is based on whether the line containing the keyword begins with "Function" or "Sub." If a keyword appears in an assignment statement, the result classification may contain bugs. The determination is based on whether an equals sign follows the keyword. S3. Predict the results based on the selected code execution items and output a code execution report; S4. After confirming that everything is correct, output the final code and the final execution report.
2. The method for upgrading VB.NET code according to claim 1, characterized in that, In step S2, when selecting or filtering the code location to be executed, the location is determined based on keywords, and the search is classified based on the different positions and functions of the keywords in the code, and the filtered results after classification are output based on the classification search.
3. The method for upgrading VB.NET code according to claim 2, characterized in that, Category retrieval includes combining keywords in different scenarios or keywords located in different positions in the code, as well as simultaneously retrieving multiple keywords.
4. The method for upgrading VB.NET code according to claim 3, characterized in that, The code modification program includes regular expressions and replacement text.
5. A method for upgrading VB.NET code according to claim 4, characterized in that, The code modification and analysis programs support online rule editing, and the execution of code execution items after modification based on selected known modification or analysis rules. The modified rules are stored as new known modification or analysis rules, and keywords are redefined for future use; or the code of the modification or analysis rules can be imported through storage media.
6. The method for upgrading VB.NET code according to claim 1, characterized in that, The code execution report shows the modifications made to the corresponding files after the selected modification or analysis rules were executed, as well as the suggested modifications. It also marks problematic code, along with the code path, line number, and problem description.
7. A system for upgrading VB.NET code, characterized in that, The system employs the method for upgrading VB.NET code as described in any one of claims 1-6.
Citation Information
Patent Citations
Source code upgrading method and system
CN110941441A
User-extensible rule-based source code modification
US20080295069A1