Exemplo n.º 1
0
        private static void ResolveEnumValues(EnumDefinition enumDef)
        {
            if (!enumDef.Options.Proto)
            {
                return;
            }

            if (enumDef.UnderlyingType.NetType != "int")
            {
                return;
            }

            var nextValue = (int?)0;

            foreach (var member in enumDef.Members)
            {
                member.ProtoValue = string.IsNullOrEmpty(member.Value)
                    ? nextValue
                    : enumDef.GetValidUnderlyingValue(member.Value) as int?;

                nextValue = member.ProtoValue + 1;
            }
        }