예제 #1
0
        /// <summary>
        /// The CRhCmn_ZooClient; ReturnLicense(), CheckOutLicense(),
        /// CheckInLicense(), ConvertLicense(), and GetLicenseType() methods call
        /// this method with the appropriate mode.
        /// </summary>
        /// <param name="mode">Calling function Id</param>
        /// <param name="id">License type Id</param>
        /// <returns></returns>
        static int UuidHelper(int mode, Guid id)
        {
            // Keep these values in synch with the values located at the top
            // of the rh_licensemanager.cpp file in the rhcommon_c project.
            const int modeReturnLicense   = 1;
            const int modeCheckOutLicense = 2;
            const int modeCheckInLicense  = 3;
            const int modeConvertLicense  = 4;
            const int modeGetLicenseType  = 5;

            switch (mode)
            {
            case modeReturnLicense:
                return(LicenseUtils.ReturnLicense(id) ? 1 : 0);

            case modeCheckOutLicense:
                return(LicenseUtils.CheckOutLicense(id) ? 1 : 0);

            case modeCheckInLicense:
                return(LicenseUtils.CheckInLicense(id) ? 1 : 0);

            case modeConvertLicense:
                return(LicenseUtils.ConvertLicense(id) ? 1 : 0);

            case modeGetLicenseType:
                return(LicenseUtils.GetLicenseType(id));
            }
            return(0);
        }