public SubSystem(string id, LoaderType loader, string[] initFiles, string[] initPaths, string[] extensions, string[] excludePaths) : base(id, 0) { _loader = loader; _initFiles = new List<string>(); if (initFiles != null) { _initFiles.AddRange(initFiles); } _initPaths = new List<string>(); if (initPaths != null) { _initPaths.AddRange(initPaths); } _extensions = new List<string>(); if (extensions != null) { _extensions.AddRange(extensions); } _excludePaths = new List<string>(); if (excludePaths != null) { _excludePaths.AddRange(excludePaths); } }
public EnumData(string name, uint offset, uint address, EnumType type, int value, uint pluginLine) : base(name, offset, address, pluginLine) { _type = type; _value = value; Values = new ObservableCollection<EnumValue>(); }
public void AddResource(EnumType.Resource resource, bool reset) { Player.AddResource(resource); if (reset) Player.ResetResource(); GetComponent<PhotonView>().RPC("RpcAddResource", PhotonTargets.Others, (byte)resource, reset); }
public EnumFieldGenerator(FieldInfo fld) : base(fld) { _enum = fld.DeclaringType.ParentConfig.ResolveName<EnumType>( fld.DeclaringType, ((EnumTypeRef)fld).TypeName ); _generator = new EnumTypeGenerator(_enum); }
/// <summary></summary> public MultInputItem(string promptingText,FieldValueType valueType,ArrayList currentValues,EnumType enumerationType,DefCat defCategory,ReportFKType fKType) { PromptingText=promptingText; ValueType=valueType; CurrentValues=currentValues; EnumerationType=enumerationType; DefCategory=defCategory; FKType=fKType; }
public SubSystem(string id, uint hash) : base(id, hash) { _initFiles = new List<string>(); _initPaths = new List<string>(); _extensions = new List<string>(); _excludePaths = new List<string>(); _loader = LoaderType.INI; }
private void EmitReadEnum(EnumType enumType) { OpenScope($"public static uint Read(this NativeReader reader, uint offset, out {enumType.Name} value)"); WriteLine($"uint ivalue;"); WriteLine("offset = reader.DecodeUnsigned(offset, out ivalue);"); WriteLine($"value = ({enumType.Name})ivalue;"); WriteLine("return offset;"); CloseScope("Read"); }
///<summary>Overload for ValueKind Enum.</summary> public ParameterField(string thisName,FieldValueType thisValueType,ArrayList theseDefaultValues,string thisPromptingText,string thisSnippet,EnumType thisEnumerationType) { name=thisName; valueType=thisValueType; defaultValues=theseDefaultValues; promptingText=thisPromptingText; snippet=thisSnippet; enumerationType=thisEnumerationType; defCategory=DefCat.AccountColors;//arbitrary fKeyType=ReportFKType.None; }
///<summary>This is how parameters are generally added. The currentValues and outputValue will be determined during the Report.SubmitQuery call.</summary> public ParameterField(string thisName,FieldValueType thisValueType,object thisDefaultValue,string thisPromptingText,string thisSnippet) { name=thisName; valueType=thisValueType; defaultValues=new ArrayList(); defaultValues.Add(thisDefaultValue); promptingText=thisPromptingText; snippet=thisSnippet; enumerationType=EnumType.ApptStatus;//arbitrary defCategory=DefCat.AccountColors;//arbitrary fKeyType=ReportFKType.None; }
public override void UpdateContent() { var explicitType = ExplicitType.Enum; var enumType = new EnumType(); if (SelectedJournalColumnType == JournalColumnType.JournalEventNameType) enumType = EnumType.JournalEventNameType; if (SelectedJournalColumnType == JournalColumnType.JournalEventDescriptionType) enumType = EnumType.JournalEventDescriptionType; if (SelectedJournalColumnType == JournalColumnType.JournalObjectType) enumType = EnumType.JournalObjectType; if (SelectedJournalColumnType == JournalColumnType.DeviceDateTime || SelectedJournalColumnType == JournalColumnType.SystemDateTime) explicitType = ExplicitType.DateTime; if (SelectedJournalColumnType == JournalColumnType.JournalObjectUid) explicitType = ExplicitType.String; ResultArgument.Update(Procedure, explicitType, enumType); }
public void SetEnum() { var code = @" function Func(this, arg2) this.EnumValue = arg2 end return Func "; var ret = luaSvr.luaState.doString(code); Assert.AreEqual(typeof(LuaFunction), ret.GetType()); this.EnumValue = EnumType.AlphaEnum; var func = ret as LuaFunction; func.call(this, EnumType.FlyEnum); Assert.AreEqual(EnumType.FlyEnum, this.EnumValue); }
public void SetEnum2() { var code = @" function Func(this) this.EnumValue = 3 -- DogEnum end return Func "; var ret = luaSvr.luaState.doString(code); Assert.AreEqual(typeof(LuaFunction), ret.GetType()); this.EnumValue = EnumType.AlphaEnum; var func = ret as LuaFunction; func.call(this, 123123); // arg 2, useless Assert.AreEqual(EnumType.DogEnum, this.EnumValue); }
// Enum, как аргумент метода public static void MethodEnum(EnumType e) { switch (e) { case EnumType.Zero: Console.WriteLine("Число 0"); break; case EnumType.Two: Console.WriteLine("Число 2"); break; case EnumType.Five: Console.WriteLine("Число 5"); break; case EnumType.Ten: Console.WriteLine("Число 10"); break; default: break; } }
protected void DropDownList() { EnumType type = new EnumType();//枚举类 List<EnumType> SettleTypeItem = type.GetName("SettleType"); List<EnumType> BoxTypeItem = type.GetName("BoxType"); EnumType item = new EnumType(); item.Text = "所有"; item.Value = -1; SettleTypeItem.Insert(0, item); BoxTypeItem.Insert(0, item); DDl_SettleType.DataSource = SettleTypeItem; DDl_SettleType.DataTextField = "Text"; DDl_SettleType.DataValueField = "Value"; DDl_SettleType.DataBind(); ddl_BoxType.DataSource = BoxTypeItem; ddl_BoxType.DataTextField = "Text"; ddl_BoxType.DataValueField = "Value"; ddl_BoxType.DataBind(); }
/// <summary> /// 页面DorpDownList控件绑定 /// </summary> private void DropDownList() { EnumType enumtype = new EnumType(); ddl_WeightCalType.DataSource = enumtype.GetName("WeightCalType"); ddl_WeightCalType.DataTextField = "Text"; ddl_WeightCalType.DataValueField = "Value"; ddl_WeightCalType.DataBind(); ddl_SettleType.DataSource = enumtype.GetName("SettleType"); ddl_SettleType.DataTextField = "Text"; ddl_SettleType.DataValueField = "Value"; ddl_SettleType.DataBind(); ddl_WeightDiscountType.DataSource = enumtype.GetName("DiscountType"); ddl_WeightDiscountType.DataTextField = "Text"; ddl_WeightDiscountType.DataValueField = "Value"; ddl_WeightDiscountType.DataBind(); ddl_FeeDiscountType.DataSource = enumtype.GetName("DiscountType"); ddl_FeeDiscountType.DataTextField = "Text"; ddl_FeeDiscountType.DataValueField = "Value"; ddl_FeeDiscountType.DataBind(); }
/// <summary>Overload for using Enum.</summary> public void AddInputItem(string promptingText,FieldValueType valueType,ArrayList currentValues,EnumType enumerationType){ if(currentValues==null) currentValues=new ArrayList(); multInputItems.Add(new MultInputItem(promptingText,valueType,currentValues,enumerationType,DefCat.AccountColors,ReportFKType.None)); }
int[] IAttackPoints.GetAttackPoints(EnumType line = EnumType.None) { if (line == EnumType.melee) { //Debe sumar todos los puntos de ataque de las cartas melee y retornar los valores por jugador. int[] totalAttack = new int[] { 0, 0 }; for (int i = 0; i < 2; i++) { if (playerCards[i].ContainsKey(EnumType.melee)) { foreach (CombatCard card in playerCards[i][EnumType.melee]) { totalAttack[i] += card.AttackPoints; } } } return(totalAttack); } else if (line == EnumType.range) { //Debe sumar todos los puntos de ataque de las cartas range y retornar los valores por jugador. int[] totalAttack = new int[] { 0, 0 }; for (int i = 0; i < 2; i++) { if (playerCards[i].ContainsKey(EnumType.range)) { foreach (CombatCard card in playerCards[i][EnumType.range]) { totalAttack[i] += card.AttackPoints; } } } return(totalAttack); } else if (line == EnumType.longRange) { //Debe sumar todos los puntos de ataque de las cartas longRange y retornar los valores por jugador. int[] totalAttack = new int[] { 0, 0 }; for (int i = 0; i < 2; i++) { if (playerCards[i].ContainsKey(EnumType.longRange)) { foreach (CombatCard card in playerCards[i][EnumType.longRange]) { totalAttack[i] += card.AttackPoints; } } } return(totalAttack); } else { int[] totalAttack = new int[] { 0, 0 }; Console.WriteLine("Invalid Option"); return(totalAttack = null); } }
/// <summary> /// The variable's or method's base type will be resolved (if auto type, the intializer's type will be taken). /// A class' base class will be searched. /// etc.. /// </summary> public static AbstractType HandleNodeMatch( INode m, ResolutionContext ctxt, AbstractType resultBase = null, object typeBase = null) { AbstractType ret = null; // See https://github.com/aBothe/Mono-D/issues/161 int stkC; if (stackCalls == null) { stackCalls = new Dictionary <INode, int>(); stackCalls[m] = stkC = 1; } else if (stackCalls.TryGetValue(m, out stkC)) { stackCalls[m] = ++stkC; } else { stackCalls[m] = stkC = 1; } /* * Pushing a new scope is only required if current scope cannot be found in the handled node's hierarchy. * Edit: No, it is required nearly every time because of nested type declarations - then, we do need the * current block scope. */ bool popAfterwards; { var newScope = m is IBlockNode ? (IBlockNode)m : m.Parent as IBlockNode; popAfterwards = ctxt.ScopedBlock != newScope && newScope != null; if (popAfterwards) { var options = ctxt.CurrentContext.ContextDependentOptions; var applyOptions = ctxt.ScopedBlockIsInNodeHierarchy(m); ctxt.PushNewScope(newScope); if (applyOptions) { ctxt.CurrentContext.ContextDependentOptions = options; } } } var canResolveBase = ((ctxt.Options & ResolutionOptions.DontResolveBaseTypes) != ResolutionOptions.DontResolveBaseTypes) && stkC < 10 && (m.Type == null || m.Type.ToString(false) != m.Name); // To support resolving type parameters to concrete types if the context allows this, introduce all deduced parameters to the current context if (resultBase is DSymbol) { ctxt.CurrentContext.IntroduceTemplateParameterTypes((DSymbol)resultBase); } var importSymbolNode = m as ImportSymbolNode; var variable = m as DVariable; // Only import symbol aliases are allowed to search in the parse cache if (importSymbolNode != null) { ret = HandleImportSymbolMatch(importSymbolNode, ctxt); } else if (variable != null) { AbstractType bt = null; if (!(variable is EponymousTemplate)) { if (canResolveBase) { var bts = TypeDeclarationResolver.Resolve(variable.Type, ctxt); ctxt.CheckForSingleResult(bts, variable.Type); if (bts != null && bts.Length != 0) { bt = bts [0]; } // For auto variables, use the initializer to get its type else if (variable.Initializer != null) { bt = DResolver.StripMemberSymbols(Evaluation.EvaluateType(variable.Initializer, ctxt)); } // Check if inside an foreach statement header if (bt == null && ctxt.ScopedStatement != null) { bt = GetForeachIteratorType(variable, ctxt); } } // Note: Also works for aliases! In this case, we simply try to resolve the aliased type, otherwise the variable's base type ret = variable.IsAlias ? new AliasedType(variable, bt, typeBase as ISyntaxRegion) as MemberSymbol : new MemberSymbol(variable, bt, typeBase as ISyntaxRegion); } else { ret = new EponymousTemplateType(variable as EponymousTemplate, GetInvisibleTypeParameters(variable, ctxt).AsReadOnly(), typeBase as ISyntaxRegion); } } else if (m is DMethod) { ret = new MemberSymbol(m as DNode, canResolveBase ? GetMethodReturnType(m as DMethod, ctxt) : null, typeBase as ISyntaxRegion); } else if (m is DClassLike) { ret = HandleClassLikeMatch(m as DClassLike, ctxt, typeBase, canResolveBase); } else if (m is DModule) { var mod = (DModule)m; if (typeBase != null && typeBase.ToString() != mod.ModuleName) { var pack = ctxt.ParseCache.LookupPackage(typeBase.ToString()).FirstOrDefault(); if (pack != null) { ret = new PackageSymbol(pack, typeBase as ISyntaxRegion); } } else { ret = new ModuleSymbol(m as DModule, typeBase as ISyntaxRegion); } } else if (m is DEnum) { ret = new EnumType((DEnum)m, typeBase as ISyntaxRegion); } else if (m is TemplateParameter.Node) { //ResolveResult[] templateParameterType = null; //TODO: Resolve the specialization type //var templateParameterType = TemplateInstanceHandler.ResolveTypeSpecialization(tmp, ctxt); ret = new TemplateParameterSymbol((m as TemplateParameter.Node).TemplateParameter, null, typeBase as ISyntaxRegion); } else if (m is NamedTemplateMixinNode) { var tmxNode = m as NamedTemplateMixinNode; ret = new MemberSymbol(tmxNode, canResolveBase ? ResolveSingle(tmxNode.Type, ctxt) : null, typeBase as ISyntaxRegion); } if (popAfterwards) { ctxt.Pop(); } else if (resultBase is DSymbol) { ctxt.CurrentContext.RemoveParamTypesFromPreferredLocals((DSymbol)resultBase); } if (stkC == 1) { stackCalls.Remove(m); } else { stackCalls[m] = stkC - 1; } return(ret); }
protected override void VisitEdmEnumType(EnumType item) { _schemaWriter.WriteEnumTypeElementHeader(item); base.VisitEdmEnumType(item); _schemaWriter.WriteEndElement(); }
public string VisitEnum(EnumType e) { return(DefaultPrefix); }
public EnumLookupTable(EnumType enumType, TableReference reference) { EnumType = enumType; Rows = new List <EnumLookupTableRow>(); if (enumType.IsFlags) { foreach (var enumField in enumType.Members) { var enumValue = enumField.Value; switch (enumType.UnderlyingType.PrimitiveTypeKind) { case PrimitiveTypeKind.Byte: case PrimitiveTypeKind.SByte: if (((byte)enumValue & ((byte)enumValue - 1)) != 0) { // composed enum value continue; } break; case PrimitiveTypeKind.Int16: if (((short)enumValue & ((short)enumValue - 1)) != 0) { // composed enum value continue; } break; case PrimitiveTypeKind.Int32: if (((int)enumValue & ((int)enumValue - 1)) != 0) { // composed enum value continue; } break; case PrimitiveTypeKind.Int64: if (((long)enumValue & ((long)enumValue - 1)) != 0) { // composed enum value continue; } break; default: throw new ArgumentOutOfRangeException(); } var name = enumField.Name.SeparateWords(); Rows.Add(new EnumLookupTableRow { Id = enumValue.ToString(), Name = name }); } } else { foreach (var enumField in enumType.Members) { var enumValue = enumField.Value.ToString(); var name = enumField.Name.SeparateWords(); Rows.Add(new EnumLookupTableRow { Id = enumValue, Name = name }); } } References = new List <TableReference> { reference }; }
public CodeFormatter VisitEnum(EnumType e) { throw new NotImplementedException(); }
///<summary>Overload for ValueKind DefCat.</summary> public ParameterField(string thisName,FieldValueType thisValueType,ArrayList theseDefaultValues,string thisPromptingText,string thisSnippet,DefCat thisDefCategory){ name=thisName; valueType=thisValueType; defaultValues=theseDefaultValues; promptingText=thisPromptingText; snippet=thisSnippet; enumerationType=EnumType.ApptStatus;//arbitrary defCategory=thisDefCategory; fKeyType=ReportFKType.None; }
private void AddResource(EnumType.Resource resource) { GameController.Instance.AddResource(resource,true); Deactivate(); }
/// <summary> /// 给棍台发送相应动作 /// </summary> /// <param name="oper"></param> /// <param name="para"></param> /// <returns></returns> public bool SendOrdr(EnumType oper, EnumPara para) { return(JTWcfHelper.WcfMainHelper.SendOrder(_id, new CommonDeviceOrderObj(DeviceOrderTypeEnum.OrderIndexOne, (int)oper, (int)para))); }
public static string ConstructMapper(this IType type, string serializedName, IParameter parameter, bool isPageable, bool expandComposite) { var builder = new IndentedStringBuilder(" "); string defaultValue = null; bool isRequired = false; bool isConstant = false; Dictionary <Constraint, string> constraints = null; if (parameter != null) { defaultValue = parameter.DefaultValue; isRequired = parameter.IsRequired; isConstant = parameter.IsConstant; constraints = parameter.Constraints; } CompositeType composite = type as CompositeType; if (composite != null && composite.ContainsConstantProperties) { defaultValue = "{}"; } SequenceType sequence = type as SequenceType; DictionaryType dictionary = type as DictionaryType; PrimaryType primary = type as PrimaryType; EnumType enumType = type as EnumType; builder.AppendLine("").Indent(); if (isRequired) { builder.AppendLine("required: true,"); } else { builder.AppendLine("required: false,"); } if (isConstant) { builder.AppendLine("isConstant: true,"); } if (serializedName != null) { builder.AppendLine("serializedName: '{0}',", serializedName); } if (defaultValue != null) { builder.AppendLine("defaultValue: {0},", defaultValue); } if (constraints != null && constraints.Count > 0) { builder.AppendLine("constraints: {").Indent(); var keys = constraints.Keys.ToList <Constraint>(); for (int j = 0; j < keys.Count; j++) { var constraintValue = constraints[keys[j]]; if (keys[j] == Constraint.Pattern) { constraintValue = string.Format(CultureInfo.InvariantCulture, "'{0}'", constraintValue); } if (j != keys.Count - 1) { builder.AppendLine("{0}: {1},", keys[j], constraintValue); } else { builder.AppendLine("{0}: {1}", keys[j], constraintValue); } } builder.Outdent().AppendLine("},"); } // Add type information if (primary != null) { if (primary.Type == KnownPrimaryType.Boolean) { builder.AppendLine("type: {").Indent().AppendLine("name: 'Boolean'").Outdent().AppendLine("}"); } else if (primary.Type == KnownPrimaryType.Int || primary.Type == KnownPrimaryType.Long || primary.Type == KnownPrimaryType.Decimal || primary.Type == KnownPrimaryType.Double) { builder.AppendLine("type: {").Indent().AppendLine("name: 'Number'").Outdent().AppendLine("}"); } else if (primary.Type == KnownPrimaryType.String) { builder.AppendLine("type: {").Indent().AppendLine("name: 'String'").Outdent().AppendLine("}"); } else if (primary.Type == KnownPrimaryType.ByteArray) { builder.AppendLine("type: {").Indent().AppendLine("name: 'ByteArray'").Outdent().AppendLine("}"); } else if (primary.Type == KnownPrimaryType.Date) { builder.AppendLine("type: {").Indent().AppendLine("name: 'Date'").Outdent().AppendLine("}"); } else if (primary.Type == KnownPrimaryType.DateTime) { builder.AppendLine("type: {").Indent().AppendLine("name: 'DateTime'").Outdent().AppendLine("}"); } else if (primary.Type == KnownPrimaryType.DateTimeRfc1123) { builder.AppendLine("type: {").Indent().AppendLine("name: 'DateTimeRfc1123'").Outdent().AppendLine("}"); } else if (primary.Type == KnownPrimaryType.TimeSpan) { builder.AppendLine("type: {").Indent().AppendLine("name: 'TimeSpan'").Outdent().AppendLine("}"); } else if (primary.Type == KnownPrimaryType.Object) { builder.AppendLine("type: {").Indent().AppendLine("name: 'Object'").Outdent().AppendLine("}"); } else if (primary.Type == KnownPrimaryType.Stream) { builder.AppendLine("type: {").Indent().AppendLine("name: 'Stream'").Outdent().AppendLine("}"); } else { throw new NotImplementedException(string.Format(CultureInfo.InvariantCulture, Resources.InvalidType, primary)); } } else if (enumType != null) { builder.AppendLine("type: {") .Indent() .AppendLine("name: 'Enum',") .AppendLine("allowedValues: {0}", enumType.GetEnumValuesArray()) .Outdent() .AppendLine("}"); } else if (sequence != null) { builder.AppendLine("type: {") .Indent() .AppendLine("name: 'Sequence',") .AppendLine("element: {") .Indent() .AppendLine("{0}", sequence.ElementType.ConstructMapper(sequence.ElementType.Name + "ElementType", null, false, false)) .Outdent().AppendLine("}").Outdent().AppendLine("}"); } else if (dictionary != null) { builder.AppendLine("type: {") .Indent() .AppendLine("name: 'Dictionary',") .AppendLine("value: {") .Indent() .AppendLine("{0}", dictionary.ValueType.ConstructMapper(dictionary.ValueType.Name + "ElementType", null, false, false)) .Outdent().AppendLine("}").Outdent().AppendLine("}"); } else if (composite != null) { builder.AppendLine("type: {") .Indent() .AppendLine("name: 'Composite',"); if (composite.PolymorphicDiscriminator != null) { builder.AppendLine("polymorphicDiscriminator: '{0}',", composite.PolymorphicDiscriminator); var polymorphicType = composite; while (polymorphicType.BaseModelType != null) { polymorphicType = polymorphicType.BaseModelType; } builder.AppendLine("uberParent: '{0}',", polymorphicType.Name); } if (!expandComposite) { builder.AppendLine("className: '{0}'", composite.Name).Outdent().AppendLine("}"); } else { builder.AppendLine("className: '{0}',", composite.Name) .AppendLine("modelProperties: {").Indent(); var composedPropertyList = new List <Property>(composite.ComposedProperties); for (var i = 0; i < composedPropertyList.Count; i++) { var prop = composedPropertyList[i]; var serializedPropertyName = prop.SerializedName; PropertyInfo nextLinkName = null; string nextLinkNameValue = null; if (isPageable) { var itemName = composite.GetType().GetProperty("ItemName"); nextLinkName = composite.GetType().GetProperty("NextLinkName"); nextLinkNameValue = (string)nextLinkName.GetValue(composite); if (itemName != null && ((string)itemName.GetValue(composite) == prop.Name)) { serializedPropertyName = ""; } if (prop.Name.Contains("nextLink") && nextLinkName != null && nextLinkNameValue == null) { continue; } } if (i != composedPropertyList.Count - 1) { if (!isPageable) { builder.AppendLine("{0}: {{{1}}},", prop.Name, prop.Type.ConstructMapper(serializedPropertyName, prop, false, false)); } else { // if pageable and nextlink is also present then we need a comma as nextLink would be the next one to be added if (nextLinkNameValue != null) { builder.AppendLine("{0}: {{{1}}},", prop.Name, prop.Type.ConstructMapper(serializedPropertyName, prop, false, false)); } else { builder.AppendLine("{0}: {{{1}}}", prop.Name, prop.Type.ConstructMapper(serializedPropertyName, prop, false, false)); } } } else { builder.AppendLine("{0}: {{{1}}}", prop.Name, prop.Type.ConstructMapper(serializedPropertyName, prop, false, false)); } } // end of modelProperties and type builder.Outdent().AppendLine("}").Outdent().AppendLine("}"); } } else { throw new NotImplementedException(string.Format(CultureInfo.InvariantCulture, Resources.InvalidType, type)); } return(builder.ToString()); }
internal EnumShape(EnumType enumType) : base(enumType) { EnumType = enumType; UpdateMinSize(); }
protected override bool CloneEntity(Diagram diagram) { return(diagram.InsertEnum(EnumType.Clone())); }
//Metodos public void AddCard(Card card, int playerId = -1, EnumType buffType = EnumType.None) { //Combat o Special if (card is CombatCard) { //Agregar la de combate a su fila correspondiente if (playerId == 0 || playerId == 1) { if (playerCards[playerId].ContainsKey(card.Type)) { playerCards[playerId][card.Type].Add(card); } else { playerCards[playerId].Add(card.Type, new List <Card>() { card }); } } else { throw new IndexOutOfRangeException("No player id given"); } } else { //Es capitan? if ((playerId == 0 || playerId == 1) && buffType == EnumType.None) { //Revisar si no se a agregado el capitan if (!playerCards[playerId].ContainsKey(card.Type)) { playerCards[playerId].Add(card.Type, new List <Card>() { card }); } else { throw new FieldAccessException("Player already has captain"); } } //Es buffer? else if ((playerId == 0 || playerId == 1) && buffType != EnumType.None) { //Revisar si no se a agregado un buffer en la fila primero. if (!playerCards[playerId].ContainsKey(buffType)) { playerCards[playerId].Add(buffType, new List <Card>() { card }); } else { throw new FieldAccessException($"Player has already played a buffer card in {buffType} row"); } } else { weatherCards.Add(card as SpecialCard); } } }
public EnumConstructor(EnumType value) { }
/// <summary> /// Get the resource type from the provided resourceProvider and the portion of the method /// URL path that comes after the resourceProvider section. /// </summary> /// <param name="resourceProvider"></param> /// <param name="methodPathAfterProvider"></param> /// <param name="createResourceMethodParameters"></param> /// <returns></returns> public static string[] GetResourceTypes(string resourceProvider, string methodPathAfterProvider, IReadOnlyCollection <Parameter> createResourceMethodParameters) { if (string.IsNullOrWhiteSpace(resourceProvider)) { throw new ArgumentException("resourceProvider cannot be null or whitespace", "resourceProvider"); } if (string.IsNullOrWhiteSpace(methodPathAfterProvider)) { throw new ArgumentException("methodPathAfterProvider cannot be null or whitespace", "methodPathAfterProvider"); } List <string> resourceTypes = new List <string>(); resourceTypes.Add(resourceProvider); string[] pathSegments = methodPathAfterProvider.Split(new char[] { '/' }); for (int i = 0; i < pathSegments.Length; i += 2) { string pathSegment = pathSegments[i]; if (pathSegment.StartsWith("{", StringComparison.Ordinal) && pathSegment.EndsWith("}", StringComparison.Ordinal)) { string parameterName = pathSegment.Substring(1, pathSegment.Length - 2); Parameter parameter = createResourceMethodParameters.FirstOrDefault(methodParameter => methodParameter.Name == parameterName); if (parameter == null) { string errorMessage = string.Format(CultureInfo.CurrentCulture, "Found undefined parameter reference {0} in create resource method \"{1}/{2}/{3}\".", pathSegment, resourceMethodPrefix, resourceProvider, methodPathAfterProvider); throw new ArgumentException(errorMessage, "createResourceMethodParameters"); } if (parameter.Type == null) { string errorMessage = string.Format(CultureInfo.CurrentCulture, "Parameter reference {0} has no defined type.", pathSegment); throw new ArgumentException(errorMessage, "createResourceMethodParameters"); } EnumType parameterType = parameter.Type as EnumType; if (parameterType == null) { string errorMessage = string.Format(CultureInfo.CurrentCulture, "Parameter reference {0} is defined as a type other than an EnumType: {1}", pathSegment, parameter.Type.GetType().Name); throw new ArgumentException(errorMessage, "createResourceMethodParameters"); } if (parameterType.Values == null || parameterType.Values.Count == 0) { string errorMessage = string.Format(CultureInfo.CurrentCulture, "Parameter reference {0} is defined as an EnumType, but it doesn't have any specified values.", pathSegment); throw new ArgumentException(errorMessage, "createResourceMethodParameters"); } List <string> newResourceTypes = new List <string>(); foreach (string resourceType in resourceTypes) { foreach (EnumValue parameterValue in parameterType.Values) { newResourceTypes.Add(string.Join("/", resourceType, parameterValue.Name)); } } resourceTypes = newResourceTypes; } else { for (int j = 0; j < resourceTypes.Count; ++j) { resourceTypes[j] = string.Join("/", resourceTypes[j], pathSegment); } } } return(resourceTypes.ToArray()); }
private bool EnterEnum(EnumType type, string name, uint offset, bool visible, uint pluginLine) { if (visible || _showInvisibles) { _currentEnum = new EnumData(name, offset, 0, type, 0, pluginLine); return true; } return false; }
protected override EnumTypeModel NewEnumTypeModel(EnumType enumType) { return(new FluentEnumTypeModel(enumType, _package)); }
public void TheNameShouldBeFullNameAndAssembly() { var enumType = new EnumType<B>(); enumType.Name.Should().Be(typeof(EnumType<B>).FullName + ", NHibernate"); }
public static Type GetClrType(this EnumType enumType) { DebugCheck.NotNull(enumType); return(enumType.Annotations.GetClrType()); }
public int this[EnumType.Resource i] { get { return _resource[i]; } set { _resource[i] = value; } }
public void VisitEnum(EnumType e) { throw new NotImplementedException(); }
public void AddResource(EnumType.Resource resource) { Stats.Max[resource]++; }
public CSharpFormatterTableSerializer(FmtInstructionDef[] defs, EnumType ctorKindEnum, string define, string @namespace) : base(defs, CSharpIdentifierConverter.Create(), ctorKindEnum["Previous"]) { this.define = define; this.@namespace = @namespace; }
/// <summary> /// Converts the given value object to the specified destination type. /// </summary> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException(nameof(destinationType)); } if (destinationType == typeof(string) && value != null) { // Raise an argument exception if the value isn't defined and if // the enum isn't a flags style. if (!EnumType.IsDefined(typeof(FlagsAttribute), false) && !Enum.IsDefined(EnumType, value)) { throw new ArgumentException(SR.Format(SR.EnumConverterInvalidValue, value, EnumType.Name)); } return(Enum.Format(EnumType, value, "G")); } if (destinationType == typeof(InstanceDescriptor) && value != null) { string enumName = ConvertToInvariantString(context, value); if (EnumType.IsDefined(typeof(FlagsAttribute), false) && enumName.Contains(',')) { // This is a flags enum, and there is no one flag // that covers the value. Instead, convert the // value to the underlying type and invoke // a ToObject call on enum. // Type underlyingType = Enum.GetUnderlyingType(EnumType); if (value is IConvertible) { object convertedValue = ((IConvertible)value).ToType(underlyingType, culture); MethodInfo method = typeof(Enum).GetMethod("ToObject", new Type[] { typeof(Type), underlyingType }); if (method != null) { return(new InstanceDescriptor(method, new object[] { EnumType, convertedValue })); } } } else { FieldInfo info = EnumType.GetField(enumName); if (info != null) { return(new InstanceDescriptor(info, null)); } } } if (destinationType == typeof(Enum[]) && value != null) { if (EnumType.IsDefined(typeof(FlagsAttribute), false)) { bool isUnderlyingTypeUInt64 = Enum.GetUnderlyingType(EnumType) == typeof(ulong); List <Enum> flagValues = new List <Enum>(); Array objValues = Enum.GetValues(EnumType); long[] ulValues = new long[objValues.Length]; for (int idx = 0; idx < objValues.Length; idx++) { ulValues[idx] = GetEnumValue(isUnderlyingTypeUInt64, (Enum)objValues.GetValue(idx), culture); } long longValue = GetEnumValue(isUnderlyingTypeUInt64, (Enum)value, culture); bool valueFound = true; while (valueFound) { valueFound = false; foreach (long ul in ulValues) { if ((ul != 0 && (ul & longValue) == ul) || ul == longValue) { flagValues.Add((Enum)Enum.ToObject(EnumType, ul)); valueFound = true; longValue &= ~ul; break; } } if (longValue == 0) { break; } } if (!valueFound && longValue != 0) { flagValues.Add((Enum)Enum.ToObject(EnumType, longValue)); } return(flagValues.ToArray()); } else { return(new Enum[] { (Enum)Enum.ToObject(EnumType, value) }); } } return(base.ConvertTo(context, culture, value, destinationType)); }
private static IType NormalizeEnumType(EnumType enumType) { return(enumType); }
/// <summary> /// Gets a value indicating whether the list of standard values returned from /// <see cref='System.ComponentModel.TypeConverter.GetStandardValues()'/> /// is an exclusive list using the specified context. /// </summary> public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return(!EnumType.IsDefined(typeof(FlagsAttribute), false)); }
public void TestEnumsReflective() { PortableMarshaller marsh = new PortableMarshaller(new PortableConfiguration { TypeConfigurations = new List<PortableTypeConfiguration> {new PortableTypeConfiguration(typeof (EnumType))} }); EnumType obj = new EnumType { PEnum = TestEnum.Val1, PEnumArray = new[] {TestEnum.Val2, TestEnum.Val3} }; byte[] bytes = marsh.Marshal(obj); IPortableObject portObj = marsh.Unmarshal<IPortableObject>(bytes, PortableMode.ForcePortable); Assert.AreEqual(obj.GetHashCode(), portObj.GetHashCode()); EnumType newObj = portObj.Deserialize<EnumType>(); Assert.AreEqual(obj.PEnum, newObj.PEnum); Assert.AreEqual(obj.PEnumArray, newObj.PEnumArray); }
protected abstract void Generate(EnumType enumType);
public void Deal() { try { protoContent = File.ReadAllText(protoFullPath); } catch (FileNotFoundException ex) { UnityEngine.Debug.LogError(string.Format("读取proto文件错误,文件路径无效 {0}\r\n{1}\r\n{2}", protoFullPath, ex.Message, ex.StackTrace)); return; } catch (DirectoryNotFoundException ex) { UnityEngine.Debug.LogError(string.Format("读取proto文件错误,目录无效 {0}\r\n{1}\r\n{2}", protoFullPath, ex.Message, ex.StackTrace)); return; } catch (IOException ex) { UnityEngine.Debug.LogError(string.Format("读取proto文件错误,文件IO被占用 {0}\r\n{1}\r\n{2}", protoFullPath, ex.Message, ex.StackTrace)); return; } catch (Exception ex) { UnityEngine.Debug.LogError(string.Format("读取proto文件错误 {0}\r\n{1}\r\n{2}", protoFullPath, ex.Message, ex.StackTrace)); return; } Match packageMatch = Regex.Match(protoContent, pattern_Package); if (packageMatch != null) { string strTemp = packageMatch.Value; package = strTemp.Replace("package ", string.Empty).Replace(';', ' ').Trim(); } MatchCollection importedProtoMatchCollection = Regex.Matches(protoContent, pattern_ImportProto); if (importedProtoMatchCollection != null) { foreach (Match item in importedProtoMatchCollection) { string newProtoName = item.Value.Replace("import", string.Empty).Replace('\"', ' ').Replace(';', ' ').Replace(".proto", string.Empty).Trim(); string dirPath = Path.GetDirectoryName(protoFullPath); ProtocolControlCache_ProtoStructure importedProtoTemp = GetProtoStructure(dirPath + '/' + newProtoName + ".proto"); ImportedProtos.Add(importedProtoTemp); } } MatchCollection messageMatchCollection = Regex.Matches(protoContent, Message.pattern); if (messageMatchCollection != null) { foreach (Match item in messageMatchCollection) { Message message = new Message(item.Value); message.Owner = this; if (message.Deal()) { Messages.Add(message); } } } MatchCollection enumMatchCollection = Regex.Matches(protoContent, EnumType.pattern); if (enumMatchCollection != null) { //将所有message中的枚举名放到一起 List <EnumType> enumnames = new List <EnumType>(); for (int i = 0; i < Messages.Count; i++) { for (int j = 0; j < Messages[i].Enums.Length; j++) { enumnames.Add(Messages[i].Enums[j]); } } //遍历proto中所有的枚举,若message中没有相同的枚举,则将其加入列表中 foreach (Match item in enumMatchCollection) { EnumType enumtemp = new EnumType(item.Value); if (enumtemp.Deal()) { bool isContain = false; for (int i = 0; i < enumnames.Count; i++) { if (enumnames[i].IsEqualTo(enumtemp)) { enumnames.RemoveAt(i); isContain = true; break; } } if (!isContain) { EnumsInProto.Add(enumtemp); } } } } protoContent = string.Empty; }
public Variadic(EnumType type) { this.type = type; }
private void UpdateContext(Solution solution, Project project, Compilation compilation, ReflectionCache reflectionCache) { Solution = solution; Project = project; Compilation = compilation; ReflectionCache = reflectionCache; // var diagnostics = compilation.GetDiagnostics(); // var mscorlib = compilation.GetReferencedAssemblySymbol(project.MetadataReferences.First()); // var typeNames = mscorlib.TypeNames.OrderBy(x => x).ToArray(); ObjectToString = compilation.ObjectType.GetMembers("ToString").OfType <IMethodSymbol>().Single(); String = compilation.FindType("System.String"); SpecialFunctions = compilation.FindType("System.Runtime.WootzJs.SpecialFunctions"); DefaultOf = SpecialFunctions.GetMethod("DefaultOf"); Char = compilation.FindType("System.Char"); Byte = compilation.FindType("System.Byte"); Int16 = compilation.FindType("System.Int16"); Int32 = compilation.FindType("System.Int32"); Int64 = compilation.FindType("System.Int64"); SByte = compilation.FindType("System.SByte"); UInt16 = compilation.FindType("System.UInt16"); UInt32 = compilation.FindType("System.UInt32"); UInt64 = compilation.FindType("System.UInt64"); Single = compilation.FindType("System.Single"); Double = compilation.FindType("System.Double"); Decimal = compilation.FindType("System.Decimal"); Exception = compilation.FindType("System.Exception"); InternalInit = Exception.GetMethodByName("InternalInit"); Assembly = compilation.FindType("System.Reflection.Assembly"); AssemblyConstructor = Assembly.InstanceConstructors.Single(); JsAttributeType = compilation.FindType("System.Runtime.WootzJs.JsAttribute"); JsCompilerOptionsAttribute = compilation.FindType("System.Runtime.WootzJs.JsCompilerOptionsAttribute"); PrecedesAttribute = compilation.FindType("System.Runtime.WootzJs.DependsOnAttribute"); ObjectType = compilation.FindType("System.Object"); GetType = ObjectType.GetMethod("GetType"); ObjectReferenceEquals = (IMethodSymbol)ObjectType.GetMembers("ReferenceEquals").Single(); ObjectCast = (IMethodSymbol)SpecialFunctions.GetMembers("ObjectCast").Single(); ObjectCreateDelegate = (IMethodSymbol)SpecialFunctions.GetMembers("CreateDelegate").Single(); TypeType = compilation.FindType("System.Type"); TypeArray = compilation.CreateArrayTypeSymbol(TypeType); TypeConstructor = TypeType.InstanceConstructors.Single(); TypeInit = (IMethodSymbol)TypeType.GetMembers("Init").Single(); CreateTypeParameter = (IMethodSymbol)TypeType.GetMembers("CreateTypeParameter").Single(); TypeIsInstanceOfType = (IMethodSymbol)TypeType.GetMembers("IsInstanceOfType").Single(); Type_GetTypeFromTypeFunc = (IMethodSymbol)TypeType.GetMembers("_GetTypeFromTypeFunc").Single(); GetField = TypeType.GetMethod("GetField", String); GetProperty = TypeType.GetMethod("GetProperty", String); GetMethod = TypeType.GetMethod("GetMethod", String, TypeArray); GetConstructor = TypeType.GetMethod("GetConstructor", TypeArray); AsExtensionType = compilation.FindType("System.Runtime.WootzJs.AsExtension"); JsniType = compilation.FindType("System.Runtime.WootzJs.Jsni"); EnumType = compilation.FindType("System.Enum"); EnumGetValue = EnumType.GetMethod("GetValue"); EnumInternalToObject = EnumType.GetMethod("InternalToObject"); Enumerable = compilation.FindType("System.Collections.IEnumerable"); EnumerableGeneric = compilation.FindType("System.Collections.Generic.IEnumerable`1"); Enumerator = compilation.FindType("System.Collections.IEnumerator"); EnumerableGetEnumerator = (IMethodSymbol)Enumerable.GetMembers("GetEnumerator").Single(); EnumeratorCurrent = (IPropertySymbol)Enumerator.GetMembers("Current").Single(); EnumeratorMoveNext = (IMethodSymbol)Enumerator.GetMembers("MoveNext").Single(); DelegateType = compilation.FindType("System.Delegate"); DelegateTypeConstructor = DelegateType.InstanceConstructors.Single(); DelegateTarget = (IPropertySymbol)DelegateType.GetMembers("Target").Single(); DelegateCombine = DelegateType.GetMembers("Combine").OfType <IMethodSymbol>().Single(x => x.Parameters.Count() == 2 && x.Parameters.All(y => Equals(y.Type, DelegateType))); DelegateRemove = DelegateType.GetMembers("Remove").OfType <IMethodSymbol>().Single(x => x.Parameters.Count() == 2 && x.Parameters.All(y => Equals(y.Type, DelegateType))); MulticastDelegateType = compilation.FindType("System.MulticastDelegate"); MulticastDelegateConstructor = MulticastDelegateType.InstanceConstructors.Single(x => x.Parameters.Last().Type.TypeKind == TypeKind.Array); NullableType = compilation.FindType("System.Nullable`1"); CharNullable = NullableType.Construct(Char); NullableHasValue = (IPropertySymbol)NullableType.GetMembers("HasValue").Single(); NullableValue = (IPropertySymbol)NullableType.GetMembers("Value").Single(); NullableGetValueOrDefault = (IMethodSymbol)NullableType.GetMembers("GetValueOrDefault").Single(); FieldInfo = compilation.FindType("System.Reflection.FieldInfo"); MethodInfo = compilation.FindType("System.Reflection.MethodInfo"); MemberInfo = compilation.FindType("System.Reflection.MemberInfo"); PropertyInfo = compilation.FindType("System.Reflection.PropertyInfo"); EventInfo = compilation.FindType("System.Reflection.EventInfo"); ConstructorInfo = compilation.FindType("System.Reflection.ConstructorInfo"); Attribute = compilation.FindType("System.Attribute"); FieldInfoConstructor = FieldInfo.InstanceConstructors.Single(); MethodInfoConstructor = MethodInfo.InstanceConstructors.Single(); ParameterInfo = compilation.FindType("System.Reflection.ParameterInfo"); ParameterInfoConstructor = ParameterInfo.InstanceConstructors.Single(); PropertyInfoConstructor = PropertyInfo.InstanceConstructors.Single(); EventInfoConstructor = EventInfo.InstanceConstructors.Single(); ConstructorInfoConstructor = ConstructorInfo.InstanceConstructors.Single(); TypeAttributes = compilation.FindType("System.Reflection.TypeAttributes"); TypeAttributesPublic = (IFieldSymbol)TypeAttributes.GetMembers("Public").Single(); TypeAttributesNotPublic = (IFieldSymbol)TypeAttributes.GetMembers("NotPublic").Single(); TypeAttributesNestedPublic = (IFieldSymbol)TypeAttributes.GetMembers("NestedPublic").Single(); TypeAttributesNestedPrivate = (IFieldSymbol)TypeAttributes.GetMembers("NestedPrivate").Single(); TypeAttributesNestedFamily = (IFieldSymbol)TypeAttributes.GetMembers("NestedFamily").Single(); TypeAttributesNestedAssembly = (IFieldSymbol)TypeAttributes.GetMembers("NestedAssembly").Single(); TypeAttributesNestedFamANDAssem = (IFieldSymbol)TypeAttributes.GetMembers("NestedFamANDAssem").Single(); TypeAttributesNestedFamORAssem = (IFieldSymbol)TypeAttributes.GetMembers("NestedFamORAssem").Single(); TypeAttributesAbstract = (IFieldSymbol)TypeAttributes.GetMembers("Abstract").Single(); TypeAttributesSealed = (IFieldSymbol)TypeAttributes.GetMembers("Sealed").Single(); TypeAttributesClass = (IFieldSymbol)TypeAttributes.GetMembers("Class").Single(); TypeAttributesInterface = (IFieldSymbol)TypeAttributes.GetMembers("Interface").Single(); FieldAttributes = compilation.FindType("System.Reflection.FieldAttributes"); FieldAttributesPublic = (IFieldSymbol)FieldAttributes.GetMembers("Public").Single(); FieldAttributesPrivate = (IFieldSymbol)FieldAttributes.GetMembers("Private").Single(); FieldAttributesFamily = (IFieldSymbol)FieldAttributes.GetMembers("Family").Single(); FieldAttributesAssembly = (IFieldSymbol)FieldAttributes.GetMembers("Assembly").Single(); FieldAttributesFamORAssem = (IFieldSymbol)FieldAttributes.GetMembers("FamORAssem").Single(); FieldAttributesStatic = (IFieldSymbol)FieldAttributes.GetMembers("Static").Single(); FieldAttributesInitOnly = (IFieldSymbol)FieldAttributes.GetMembers("InitOnly").Single(); FieldAttributesLiteral = (IFieldSymbol)FieldAttributes.GetMembers("Literal").Single(); MethodAttributes = compilation.FindType("System.Reflection.MethodAttributes"); MethodAttributesPublic = (IFieldSymbol)MethodAttributes.GetMembers("Public").Single(); MethodAttributesPrivate = (IFieldSymbol)MethodAttributes.GetMembers("Private").Single(); MethodAttributesFamily = (IFieldSymbol)MethodAttributes.GetMembers("Family").Single(); MethodAttributesAssembly = (IFieldSymbol)MethodAttributes.GetMembers("Assembly").Single(); MethodAttributesFamORAssem = (IFieldSymbol)MethodAttributes.GetMembers("FamORAssem").Single(); MethodAttributesStatic = (IFieldSymbol)MethodAttributes.GetMembers("Static").Single(); ParameterAttributes = compilation.FindType("System.Reflection.ParameterAttributes"); ParameterAttributesOut = (IFieldSymbol)ParameterAttributes.GetMembers("Out").Single(); ParameterAttributesHasDefault = (IFieldSymbol)ParameterAttributes.GetMembers("HasDefault").Single(); ParameterAttributesNone = (IFieldSymbol)ParameterAttributes.GetMembers("None").Single(); JsFunction = compilation.FindType("System.Runtime.WootzJs.JsFunction"); IDisposable = compilation.FindType("System.IDisposable"); IDisposableDispose = (IMethodSymbol)IDisposable.GetMembers("Dispose").Single(); Expression = compilation.FindType("System.Linq.Expressions.Expression"); ExpressionGeneric = compilation.FindType("System.Linq.Expressions.Expression`1"); ExpressionArray = compilation.CreateArrayTypeSymbol(Expression); ExpressionType = compilation.FindType("System.Linq.Expressions.ExpressionType"); ExpressionLambda = compilation.FindType("System.Linq.Expressions.Expression`1"); ParameterExpression = compilation.FindType("System.Linq.Expressions.ParameterExpression"); ParameterExpressionArray = compilation.CreateArrayTypeSymbol(ParameterExpression); NewExpression = compilation.FindType("System.Linq.Expressions.NewExpression"); MemberBinding = compilation.FindType("System.Linq.Expressions.MemberBinding"); MemberBindingArray = compilation.CreateArrayTypeSymbol(MemberBinding); ElementInit = compilation.FindType("System.Linq.Expressions.ElementInit"); ElementInitArray = compilation.CreateArrayTypeSymbol(ElementInit); Constant = compilation.FindType("System.Linq.Expressions.ConstantExpression"); Action = compilation.FindType("System.Action"); ActionT = compilation.FindType("System.Action`1"); Func = compilation.FindType("System.Func`1"); JsObject = compilation.FindType("System.Runtime.WootzJs.JsObject"); JsString = compilation.FindType("System.Runtime.WootzJs.JsString"); SafeToString = SpecialFunctions.GetMembers("SafeToString").OfType <IMethodSymbol>().Single(); Array = compilation.FindType("System.Array"); INotifyPropertyChanged = compilation.FindType("System.ComponentModel.INotifyPropertyChanged"); Task = compilation.FindType("System.Threading.Tasks.Task"); TaskT = compilation.FindType("System.Threading.Tasks.Task`1"); TaskAwaiter = compilation.FindType("System.Runtime.CompilerServices.TaskAwaiter"); TaskAwaiterT = compilation.FindType("System.Runtime.CompilerServices.TaskAwaiter`1"); Nop = compilation.FindType("System.Runtime.CompilerServices.Op").GetMethod("Nothing"); AsyncVoidMethodBuilder = compilation.FindType("System.Runtime.CompilerServices.AsyncVoidMethodBuilder"); AsyncVoidMethodBuilderCreate = AsyncVoidMethodBuilder.GetMethod("Create"); AsyncVoidMethodBuilderStart = AsyncVoidMethodBuilder.GetMethod("Start"); AsyncTaskMethodBuilder = compilation.FindType("System.Runtime.CompilerServices.AsyncTaskMethodBuilder"); AsyncTaskMethodBuilderCreate = AsyncTaskMethodBuilder.GetMethod("Create"); AsyncTaskMethodBuilderStart = AsyncTaskMethodBuilder.GetMethod("Start"); AsyncTaskTMethodBuilder = compilation.FindType("System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1"); AsyncTaskTMethodBuilderCreate = AsyncTaskTMethodBuilder.GetMethod("Create"); AsyncTaskTMethodBuilderStart = AsyncTaskTMethodBuilder.GetMethod("Start"); CallerMemberNameAttribute = compilation.FindType("System.Runtime.CompilerServices.CallerMemberNameAttribute"); CultureInfo = compilation.FindType("System.Globalization.CultureInfo"); InvalidOperationException = compilation.FindType("System.InvalidOperationException"); InvalidOperationExceptionStringConstructor = InvalidOperationException.Constructors.Single(x => x.Parameters.Count() == 1 && x.Parameters.First().Type == String); IAsyncStateMachine = compilation.FindType("System.Runtime.CompilerServices.IAsyncStateMachine"); IAsyncStateMachineMoveNext = IAsyncStateMachine.GetMethodByName("MoveNext"); IAsyncStateMachineSetStateMachine = IAsyncStateMachine.GetMethodByName("SetStateMachine"); IEnumerator = compilation.FindType("System.Collections.IEnumerator"); IEnumerable = compilation.FindType("System.Collections.IEnumerable"); IEnumeratorT = compilation.FindType("System.Collections.Generic.IEnumerator`1"); IEnumerableT = compilation.FindType("System.Collections.Generic.IEnumerable`1"); IEnumeratorCurrent = (IPropertySymbol)IEnumerator.GetMembers("Current").Single(); IEnumeratorMoveNext = (IMethodSymbol)IEnumerator.GetMembers("MoveNext").Single(); IEnumeratorReset = (IMethodSymbol)IEnumerator.GetMembers("Reset").Single(); IEnumerableGetEnumerator = (IMethodSymbol)IEnumerable.GetMembers("GetEnumerator").Single(); IEnumeratorTCurrent = (IPropertySymbol)IEnumeratorT.GetMembers("Current").Single(); IEnumerableTGetEnumerator = (IMethodSymbol)IEnumerableT.GetMembers("GetEnumerator").Single(); YieldIterator = compilation.FindType("System.YieldIterator`1"); YieldIteratorClone = YieldIterator.GetMethodByName("Clone"); YieldIteratorDoMoveNext = YieldIterator.GetMethodByName("DoMoveNext"); NullPropagation = SpecialFunctions.GetMethod("NullPropagation"); // IAutoNotifyPropertyChanged = compilation.FindType("System.Runtime.WootzJs.IAutoNotifyPropertyChanged"); // NotifyPropertyChanged = IAutoNotifyPropertyChanged.GetMethod("NotifyPropertyChanged"); }
/// <summary> /// Maps a type to enum type, if possible. /// </summary> /// <param name="dataType">Type of the data.</param> /// <returns></returns> protected virtual EnumType MapEnumDbType(IDataType dataType) { var enumType = new EnumType(); // MySQL represents enums as follows: // enum('value1','value2') Match outerMatch = DefaultEnumDefinitionEx.Match(dataType.FullType); if (outerMatch.Success) { string values = outerMatch.Groups["values"].Value; var innerMatches = EnumValuesEx.Matches(values); int currentValue = 1; foreach (Match innerMatch in innerMatches) { var value = innerMatch.Groups["value"].Value; enumType.EnumValues[value] = currentValue++; } } return enumType; }
public Expression VisitEnum(EnumType e) { throw new NotImplementedException(); }
public bool IsResourceFull(EnumType.Resource resource) { return Stats[resource] >= MaxResource; }
public void Write(EnumType x) { Write((Byte)x); }
public EnumTemplateModel(EnumType source) { this.LoadFrom(source); }
protected override void Generate(EnumType enumType) => enumGenerator.Generate(enumType);
///<summary>Default constructor.</summary> public Parameter(){ name=""; outputValue="1"; valueType=ParamValueType.String; currentValues=new ArrayList(); //defaultValues=new ArrayList(); prompt=""; snippet=""; enumerationType=EnumType.ApptStatus;//arbitrary queryText=""; }
public DataType VisitEnum(EnumType e) { return(e); }
/// <summary></summary> public void AddInputItem(string promptingText,FieldValueType valueType,ArrayList currentValues,EnumType enumerationType,DefCat defCategory,ReportFKType fKType){ multInputItems.Add(new MultInputItem(promptingText,valueType,currentValues,enumerationType,defCategory,fKType)); }
private static JsonSchema ParseProperty(Property property, IDictionary <string, JsonSchema> definitionMap) { JsonSchema propertyDefinition = null; if (!property.IsReadOnly) { propertyDefinition = new JsonSchema(); IType propertyType = property.Type; CompositeType compositeType = propertyType as CompositeType; if (compositeType != null) { propertyDefinition = ParseCompositeType(compositeType, definitionMap); propertyDefinition.Description = property.Documentation; } else { DictionaryType dictionaryType = propertyType as DictionaryType; if (dictionaryType != null) { propertyDefinition.JsonType = "object"; propertyDefinition.Description = property.Documentation; PrimaryType dictionaryPrimaryType = dictionaryType.ValueType as PrimaryType; if (dictionaryPrimaryType != null) { propertyDefinition.AdditionalProperties = ParsePrimaryType(dictionaryPrimaryType); } else { CompositeType dictionaryCompositeType = dictionaryType.ValueType as CompositeType; if (dictionaryCompositeType != null) { propertyDefinition.AdditionalProperties = ParseCompositeType(dictionaryCompositeType, definitionMap); } else { Debug.Assert(false, "Unrecognized DictionaryType.ValueType: " + dictionaryType.ValueType.GetType()); } } } else { EnumType enumType = propertyType as EnumType; if (enumType != null) { propertyDefinition = ParseEnumType(enumType); propertyDefinition.Description = property.Documentation; } else { PrimaryType primaryType = propertyType as PrimaryType; if (primaryType != null) { propertyDefinition = ParsePrimaryType(primaryType); propertyDefinition.Description = property.Documentation; propertyDefinition.Format = primaryType.Format; if (property.DefaultValue != null) { propertyDefinition.AddEnum(property.DefaultValue); } } else { SequenceType sequenceType = propertyType as SequenceType; if (sequenceType != null) { propertyDefinition.JsonType = "array"; propertyDefinition.Description = property.Documentation; IType sequenceElementType = sequenceType.ElementType; CompositeType sequenceCompositeType = sequenceElementType as CompositeType; if (sequenceCompositeType != null) { propertyDefinition.Items = ParseCompositeType(sequenceCompositeType, definitionMap); } else { PrimaryType sequencePrimaryType = sequenceElementType as PrimaryType; if (sequencePrimaryType != null) { propertyDefinition.Items = ParsePrimaryType(sequencePrimaryType); } else { EnumType sequenceEnumType = sequenceElementType as EnumType; if (sequenceEnumType != null) { propertyDefinition = ParseEnumType(sequenceEnumType); } else { Debug.Assert(false, "Unrecognized SequenceType.ElementType: " + sequenceType.ElementType.GetType()); } } } } else { Debug.Assert(false, "Unrecognized property type: " + propertyType.GetType()); } } } } } } return(propertyDefinition); }
///<summary></summary> public void AddInputItem(string myPromptingText,FieldValueType myValueType,ArrayList myCurrentValues,EnumType myEnumerationType,DefCat myDefCategory,ReportFKType myFKType){ MultInput2.AddInputItem(myPromptingText,myValueType,myCurrentValues,myEnumerationType,myDefCategory,myFKType); }
public EnumTypeModel(EnumType enumType, string package) : base() { this.LoadFrom(enumType); this._package = package.ToLower(CultureInfo.InvariantCulture); }