WisDom.Net 架構設計(六) license

來源:互聯網
上載者:User

標籤:style   blog   class   code   c   java   

WisDom.Net-license

 

1.為啥要用license

   license (許可證) 顧名思義就是說我的軟體只能給在指定的機器上使用。畢竟很多項目都不是免費的,(說句題外話,其實我用的也是盜版,哈哈)這裡我們的 license 分為 2種 1,試用版本 顯示使用人數 和期限只能有使用30天, 2,正式版本限制合約中規定的天數,下面我們來看一下,WisDom.Net中license是怎麼實現的。

2. Do.NET 中的license

    在System.ComponentModel命名空間中有以下幾個類

     1.License 為所有許可證提供 abstract 基類,而許可證將授予組件的特定執行個體。

     2.LicenseContext 指定何時可使用授權的對象,並且提供一種方法,用以擷取為支援在其域內啟動並執行許可證所需要的附加服務。

     3.LicenseException 表示當組件不能被授予許可證時引發的異常

 3. WisDom.Net中的license

     1.定義WisDomNetLicense 類,這裡採用AES加密之後存入License.src 檔案中。完成發證流程。如果要限定MAC地址,只需要在上面加上Mac地址的相關資訊就可以限定軟體只能在某台伺服器上運行了。

     

 public class WisDomNetLicense    {        /// <summary>        /// 許可證類型        /// </summary>        public  LicenseType  type{get;set;}        /// <summary>        /// 發證日期        /// </summary>        public DateTime StartTime { get; set; }        /// <summary>        /// 結束日期        /// </summary>        public DateTime EndTime { get; set; }        /// <summary>        /// 有效天數        /// </summary>        public int days { get; set; }    }    public enum LicenseType    {       Temporary,       Longterm    }

2.校正License

    在wisdom.net中我們讓使用者匯入License 其實說白了,就是講上面的License.src檔案上傳到某個目錄中, 之後我們在頁面基類中增加以下校正過程即可如:

(圖一)

 以上就是我關於License一點不成熟的想法

 

   

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.