1. 程式人生 > >獲取裝置名稱

獲取裝置名稱


using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public sealed class EncryptUtil {         public static string Md5( string value)        {
               if ( string .IsNullOrEmpty(value))               {                      
return null ;               }                //獲取運營商               System.Security.Cryptography.
MD5 md5 = new System.Security.Cryptography. MD5CryptoServiceProvider ();                //                     計算機列表                byte [] bytResult = md5.ComputeHash(System.Text. Encoding .Default.GetBytes(value));                string strResult = BitConverter .ToString(bytResult);                //                     替換               strResult = strResult.Replace( "-" , "" );                return strResult;        } }



using System.Collections; using System.Collections.Generic; using UnityEngine; public class DeviceUtil {         /// <summary>         /// 裝置識別符號         /// </summary>         public static string DeviceIdentifier        {                get               { //一個獨特的裝置識別符號。它保證每一個裝置都是獨一無二的(只讀                       return SystemInfo .deviceUniqueIdentifier;               }        }         /// <summary>         /// 獲取裝置型號         /// </summary>         public static string DeviceModel        {                get               { #if UNITY_IPHONE && !UNITY_EDITOR             return Device.generation.ToString(); #else          //裝置的模型(只讀)。                       return SystemInfo .deviceModel; #endif               }        } }