コード例 #1
0
        public int AcquireNewTokens(string id, int tokenCount, out AcquisitionChannelStatusType status)
        {
            status = AcquisitionChannelStatusType.OK;
            int tempVal = 0;

            if (!ProductCountList.TryGetValue(id, out tempVal))
            {
                ProductCountList.Add(id, tokenCount);
            }
            return(1);
        }
コード例 #2
0
        // feaature_id is the product or feature whose token count is being requested.
        // If feature_id is a product id then feature_id = <product-name>, "pro2" for example.
        // If feature_id is a feature id then feature_id = <product-name>-<feature-name>, "pro2-polymers"
        public int GetTokenCount(string feature_id, string catalog_version, out AcquisitionChannelStatusType status)
        {
            status = AcquisitionChannelStatusType.OK;

            int cntValue;

            if (productCatalog.TryGetValue(feature_id + "-" + catalog_version, out cntValue))
            {
                return(cntValue);
            }

            else
            {
                status = AcquisitionChannelStatusType.NOT_ENOUGH_TOKENS;
            }

            return(-1);
        }