如何將自己的代碼自動添加著作權資訊

來源:互聯網
上載者:User
如何將自己的代碼自動添加著作權資訊

      現在大多數公司都規定程式員在程式檔案的頭部加上著作權資訊,這樣每個人寫的檔案都可以區分開來,如果某個檔案出現問題就可以快速的找到檔案的建立人,用最短的時間來解決問題,常常是以下格式://======================================================================
//
//        Copyright (C) 2007-2008 三月軟體工作室    
//        All rights reserved
//
//        filename :Class4
//        description :
//
//        created by 侯壘 at  03/09/2008 18:41:28
//        http://houleixx.cnblogs.com
//
//======================================================================

     有些人使用Copy和Paste的方式,這樣即浪費時間,效果又不是很好,就說上面的時間你就無法去Paste,哈哈,下面我就教大家怎樣去添加這些資訊,使我們的代碼更有個性.
1.在visual studio 2005的安裝路徑下
        如:[盤符]:\Program files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplatesCache
2.找到檔案夾:
       
裡面可以為各種語言進行修改.如果對WinForm中的類進行修改可以開啟\CSharp\2052\Class.zip.其中\CSharp\2052\包括了所有WinForm檔案類型的模板.
開啟Class.zip裡面有一個Class.cs檔案,我們對其進行修改,當我們在WinForm中添加類檔案的時候,類檔案就會自動添加上我們的資訊.
如下://======================================================================
//
//        Copyright (C) 2007-2008 三月軟體工作室    
//        All rights reserved
//
//        filename :$safeitemrootname$
//        description :
//
//        created by 侯壘 at  $time$
//        http://houleixx.cnblogs.com
//
//======================================================================
using System;
using System.Collections.Generic;
using System.Text;

namespace $rootnamespace$
{
    class $safeitemrootname$
    {
    }
}

$rootnamespace$為產生類的命名空間的名字,$safeitemrootname$為產生類的類名.
可以看到我們在著作權資訊中加入了$time$,它就可以直接給我們加入建立的時間.我們可以對\CSharp\2052中所有的模板進行修改,切忌不要輕易修改系統那些代碼,以免影響我們的正常的使用.
對於做Web開發的人員來說可以在ItemTemplatesCache\Web\CSharp\2052裡進行修改.
建立一個類檔案就可以實現了插入我們自訂的著作權資訊.//======================================================================
//
//        Copyright (C) 2007-2008 三月軟體工作室    
//        All rights reserved
//
//        filename :NewClass
//        description :
//
//        created by 侯壘 at  03/09/2008 20:31:56
//        http://houleixx.cnblogs.com
//
//======================================================================
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/**//// <summary>
/// NewClass 的摘要說明
/// </summary>
public class NewClass
{
    public NewClass()
    {
        //
        // TODO: 在此處添加建構函式邏輯
        //
    }
}

哈哈,是不是很酷呀!趕快個性一下你的代碼吧!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.