Esempio n. 1
0
        public static ValueParseResult Parse(
            string specialPropertyName,
            object rawValue)
        {
            switch (specialPropertyName)
            {
            case TrackSpecialProperty.Token:
                return(StringParser.Parse(rawValue));

            case TrackSpecialProperty.DistinctId:
                return(DistinctIdParser.Parse(rawValue));

            case TrackSpecialProperty.Time:
                return(TimeParser.ParseUnix(rawValue));

            case TrackSpecialProperty.Ip:
                return(IpParser.Parse(rawValue));

            case TrackSpecialProperty.Duration:
                return(DurationParser.Parse(rawValue));

            case TrackSpecialProperty.Os:
                return(StringParser.Parse(rawValue));

            case TrackSpecialProperty.ScreenWidth:
            case TrackSpecialProperty.ScreenHeight:
                return(NumberParser.Parse(rawValue));

            default:
                return(ValueParseResult.CreateFail($"No parser for '{nameof(specialPropertyName)}'."));
            }
        }
Esempio n. 2
0
        public static ValueParseResult Parse(
            string specialPropertyName,
            object rawValue)
        {
            switch (specialPropertyName)
            {
            case PeopleSpecialProperty.Token:
                return(StringParser.Parse(rawValue));

            case PeopleSpecialProperty.DistinctId:
                return(DistinctIdParser.Parse(rawValue));

            case PeopleSpecialProperty.Ip:
                return(IpParser.Parse(rawValue));

            case PeopleSpecialProperty.Time:
                return(TimeParser.ParseUnix(rawValue));

            case PeopleSpecialProperty.IgnoreTime:
            case PeopleSpecialProperty.IgnoreAlias:
                return(BoolParser.Parse(rawValue));

            case PeopleSpecialProperty.FirstName:
            case PeopleSpecialProperty.LastName:
            case PeopleSpecialProperty.Name:
            case PeopleSpecialProperty.Email:
            case PeopleSpecialProperty.Phone:
                return(StringParser.Parse(rawValue));

            case PeopleSpecialProperty.Created:
                return(TimeParser.ParseMixpanelFormat(rawValue));

            default:
                return(ValueParseResult.CreateFail($"No parser for '{nameof(specialPropertyName)}'."));
            }
        }