Exemplo n.º 1
0
        /// <summary>
        /// Robustly parse simple license properties that return string values.
        ///
        /// http://msdn.microsoft.com/en-us/library/hh535287(v=vs.85).aspx#IPC_LI_CONTENT_ID
        /// http://msdn.microsoft.com/en-us/library/hh535287(v=vs.85).aspx#IPC_LI_OWNER
        /// http://msdn.microsoft.com/en-us/library/hh535287(v=vs.85).aspx#IPC_LI_REFERRAL_INFO_URL
        /// </summary>
        /// <returns>String description of the property</returns>
        private string getSimpleProperty(LicensePropertyType propertyType)
        {
            string returnValue;

            returnValue = "<" + propertyType.ToString() + " not present>";

            try
            {
                switch (propertyType)
                {
                case LicensePropertyType.ContentId:
                    returnValue = SafeNativeMethods.IpcGetSerializedLicenseContentId(FileLicense, KeyHandle);

                    break;

                case LicensePropertyType.Owner:
                    returnValue = SafeNativeMethods.IpcGetSerializedLicenseOwner(FileLicense);

                    break;

                case LicensePropertyType.ReferralInfoUrl:
                    returnValue = SafeNativeMethods.IpcGetSerializedLicenseReferralInfoUrl(FileLicense);

                    break;
                }
            }
            catch
            {
            }

            return(returnValue);
        }
        /// <summary>
        /// Robustly parse simple license properties that return string values.
        /// 
        /// http://msdn.microsoft.com/en-us/library/hh535287(v=vs.85).aspx#IPC_LI_CONTENT_ID
        /// http://msdn.microsoft.com/en-us/library/hh535287(v=vs.85).aspx#IPC_LI_OWNER
        /// http://msdn.microsoft.com/en-us/library/hh535287(v=vs.85).aspx#IPC_LI_REFERRAL_INFO_URL
        /// </summary>
        /// <returns>String description of the property</returns>
        private string getSimpleProperty(LicensePropertyType propertyType)
        {
            string      returnValue;

            returnValue = "<" + propertyType.ToString() + " not present>";

            try
            {
                switch(propertyType)
                {
                    case LicensePropertyType.ContentId:
                        returnValue = SafeNativeMethods.IpcGetSerializedLicenseContentId(FileLicense);

                        break;

                    case LicensePropertyType.Owner:
                        returnValue = SafeNativeMethods.IpcGetSerializedLicenseOwner(FileLicense);

                        break;

                    case LicensePropertyType.ReferralInfoUrl:
                        returnValue = SafeNativeMethods.IpcGetSerializedLicenseReferralInfoUrl(FileLicense);

                        break;
                }
            }
            catch
            {
            }

            return returnValue;
        }