• 如何使用NArrange进行代码优化


    Narrange是一个.NET代码管理工具。它可以对源代码自动进行美化和把类成员分成一个组、区域。目前支持C#、VB.NET,将来会支持更多.NET上的语言。

    主要的作用是:

    ◆ 减少程序员的开发时间
    ◆ 使得编码风格变得标准
    ◆ 能减少代码冲突
    ◆ 能代码进行分组
    ◆ 很好的灵活性

    csdn下载:http://download.csdn.net/detail/luolunz/5640737

    下载地址:http://sourceforge.net/projects/narrange/?source=dlp

    注意:Narrange目前并不支持汉语,汉语注释等代码在经过了格式化之后,会变成乱码

    Narrange常用命令如下,一般使用【空格/b】进行代码格式化,使用【空格/r】对已经格式化的代码进行还原----注意:Narrange只会保留最后一次格式化的源码格式,所以在你格式化代码后,应该确保代码能正常运行,再进行下一次的格式化。多次格式化后,会导致最初的代码格式消失(永久性)

    The command line usage is as follows:

    narrange-console <input> [output] [/c:configuration]
            [/b] [/r] [/t]
    
    
    input   Specifies the source code file, project, solution or 
            directory to arrange.
    
    output  For a single source file, specifies the output file
            to write arranged code to.
            [Optional] If not specified the input source
            file will be overwritten.
    
    /c      Configuration - Specifies the XML configuration file to use.
            [Optional] If not specified the default
            configuration will be used.
    
    /b      Backup - Specifies to create a backup before arranging
            [Optional] If not specified, no backup will be created.
            Only valid if an output file is not specified
            and cannot be used in conjunction with Restore.
    
    /r      Restore - Restores arranged files from the latest backup
            [Optional] When this flag is provided, no files will be arranged.
            Only valid if an output file is not specified
            and cannot be used in conjunction with Backup.
    
    /t      Trace - Detailed logging

    为了使用方便,通常在Visual Studio中添加外部工具的方式来使用Narrange

    1. From the Tools menu, select External Tools.
    2. Add a new entry for NArrange.
      • For the Command, select the location of narrange-console.exe.
      • For arguments, pass the solution, project or file path macro depending on your preference. When choosing this, you may want to take into consideration your revision control system (i.e. whether or not files are marked as read-only). NArrange cannot arrange read-only files. It is recommended to pass the /b argument to specify that an automatic backup be created in your user temp directory.

      插入格式化,外边工具,输入Title、执行目录所在的路径以及可执行文件名,还有参数即可,注意【空格/b】

    插入格式化还原,外边工具,输入Title、执行目录所在的路径以及可执行文件名,还有参数即可,注意【空格/r】

     

    1. It is also recommended to setup a restore command using the same parameters, replacing /b with /r. However, be careful when using restore as it will revert any edits made to a file since the last NArrange.

       

  • 相关阅读:
    SpringBoot启动类踩坑
    数组作业
    多态的使用
    intellij idea怎么设置软件启动时选择项目进入
    方法的递归调用
    取一个数字数字后4位的和
    day09作业
    java 随机数
    java 方法
    java 循环作业
  • 原文地址:https://www.cnblogs.com/snake-hand/p/3153169.html
Copyright © 2020-2023  润新知