コード例 #1
0
        public static SportRadarId Create(eVersionedObjectType vot, long lObjectId, UInt16 uiExtendedId, eLineType lt, UInt16 uiClientId)
        {
            try
            {
                ExcpHelper.ThrowIf <ArgumentException>(Math.Abs(lObjectId) > MAX_OBJECT_ID, "SportRadarId.Create(ObjectType={0}, ObjectId={1}, ExtendedId={2}, LineType={3}, Client={4}, ) ERROR. ObjectId is too big. MaxValue={5}",
                                                       vot, lObjectId, uiExtendedId, lt, uiClientId, MAX_OBJECT_ID);
                ExcpHelper.ThrowIf <ArgumentException>(uiExtendedId > MAX_EXTENDED_ID, "SportRadarId.Create(ObjectType={0}, ObjectId={1}, ExtendedId={2}, LineType={3}, Client={4}, ) ERROR. ExtendedId is too big. MaxValue={5}",
                                                       vot, lObjectId, uiExtendedId, lt, uiClientId, MAX_EXTENDED_ID);
                ExcpHelper.ThrowIf <ArgumentException>(uiClientId > MAX_CLIENT_ID, "SportRadarId.Create(ObjectType={0}, ObjectId={1}, ExtendedId={2}, LineType={3}, Client={4}, ) ERROR. ClientId is too big. MaxValue={5}",
                                                       vot, lObjectId, uiExtendedId, lt, uiClientId, MAX_CLIENT_ID);

                SportRadarId srid = new SportRadarId();

                srid.ObjectId   = lObjectId;
                srid.ExtendedId = uiExtendedId;
                srid.LineType   = lt;
                srid.ClientId   = uiClientId;
                srid.ObjectType = vot;

                return(srid);
            }
            catch (Exception excp)
            {
                throw;
            }

            return(null);
        }
コード例 #2
0
        public static SportRadarId FromLongId(long lLongId)
        {
            try
            {
                SportRadarId srid = new SportRadarId();

                long lId = Math.Abs(lLongId);

                srid.ObjectId   = (lId & MASK_OBJECT_ID) >> 31;
                srid.ExtendedId = (UInt16)((lId & MASK_EXTENDED_ID) >> 16);
                srid.LineType   = (eLineType)((lId & MASK_LINE_TYPE) >> 10);
                srid.ClientId   = (UInt16)((lId & MASK_CLIENT_ID) >> 7);
                srid.ObjectType = (eVersionedObjectType)(lId & MASK_OBJECT_TYPE);

                if (lLongId < 0)
                {
                    srid.ObjectId *= -1;
                }

                return(srid);
            }
            catch (Exception excp)
            {
                throw;
            }

            return(null);
        }