public override void Prepare() { foreach (var gameCategory in (GameCategory[])Enum.GetValues(typeof(GameCategory))) { CategoryList.Add(new GameCategoryModel(gameCategory, _resourceService)); } }
public void ValueOfKindAsTypeOfKind_EatTargetTest() { // Arrange var helper = new ExpressionKindHelper(); // Assert foreach (ExpressionKind kind in Enum.GetValues(typeof(ExpressionKind))) { if (kind != ExpressionKind.TargetCall && kind != ExpressionKind.Result && kind != ExpressionKind.Mock) { Assert.AreEqual(helper.ValueOfKindAsTypeOfKind(ExpressionKind.Target, kind), ExpressionKind.Target); } } foreach (ExpressionKind kind in Enum.GetValues(typeof(ExpressionKind))) { if (kind != ExpressionKind.TargetCall && kind != ExpressionKind.Result && kind != ExpressionKind.Mock) { Assert.AreEqual(helper.ValueOfKindAsTypeOfKind(kind, ExpressionKind.Target), ExpressionKind.Target); } } }
static Instruction() { Array values = Enum.GetValues(typeof(Bytecode)); instructions = new Instruction[values.Cast <byte>().Max() + 1]; instructions[(int)Bytecode.Invalid] = null; instructions[(int)Bytecode.INSTR_LOAD_STR] = new Instruction("load_str", OperandType.String); instructions[(int)Bytecode.INSTR_LOAD_ATTR] = new Instruction("load_attr", OperandType.String); instructions[(int)Bytecode.INSTR_LOAD_LOCAL] = new Instruction("load_local", OperandType.Int); instructions[(int)Bytecode.INSTR_LOAD_PROP] = new Instruction("load_prop", OperandType.String); instructions[(int)Bytecode.INSTR_LOAD_PROP_IND] = new Instruction("load_prop_ind"); instructions[(int)Bytecode.INSTR_STORE_OPTION] = new Instruction("store_option", OperandType.Int); instructions[(int)Bytecode.INSTR_STORE_ARG] = new Instruction("store_arg", OperandType.String); instructions[(int)Bytecode.INSTR_NEW] = new Instruction("new", OperandType.String, OperandType.Int); instructions[(int)Bytecode.INSTR_NEW_IND] = new Instruction("new_ind", OperandType.Int); instructions[(int)Bytecode.INSTR_NEW_BOX_ARGS] = new Instruction("new_box_args", OperandType.String); instructions[(int)Bytecode.INSTR_SUPER_NEW] = new Instruction("super_new", OperandType.String, OperandType.Int); instructions[(int)Bytecode.INSTR_SUPER_NEW_BOX_ARGS] = new Instruction("super_new_box_args", OperandType.String); instructions[(int)Bytecode.INSTR_WRITE] = new Instruction("write"); instructions[(int)Bytecode.INSTR_WRITE_OPT] = new Instruction("write_opt"); instructions[(int)Bytecode.INSTR_MAP] = new Instruction("map"); instructions[(int)Bytecode.INSTR_ROT_MAP] = new Instruction("rot_map", OperandType.Int); instructions[(int)Bytecode.INSTR_ZIP_MAP] = new Instruction("zip_map", OperandType.Int); instructions[(int)Bytecode.INSTR_BR] = new Instruction("br", OperandType.Address); instructions[(int)Bytecode.INSTR_BRF] = new Instruction("brf", OperandType.Address); instructions[(int)Bytecode.INSTR_OPTIONS] = new Instruction("options"); instructions[(int)Bytecode.INSTR_ARGS] = new Instruction("args"); instructions[(int)Bytecode.INSTR_PASSTHRU] = new Instruction("passthru", OperandType.String); //instructions[(int)Bytecode.INSTR_PASSTHRU_IND] = new Instruction("passthru_ind", OperandType.Int); instructions[(int)Bytecode.INSTR_LIST] = new Instruction("list"); instructions[(int)Bytecode.INSTR_ADD] = new Instruction("add"); instructions[(int)Bytecode.INSTR_TOSTR] = new Instruction("tostr"); instructions[(int)Bytecode.INSTR_FIRST] = new Instruction("first"); instructions[(int)Bytecode.INSTR_LAST] = new Instruction("last"); instructions[(int)Bytecode.INSTR_REST] = new Instruction("rest"); instructions[(int)Bytecode.INSTR_TRUNC] = new Instruction("trunc"); instructions[(int)Bytecode.INSTR_STRIP] = new Instruction("strip"); instructions[(int)Bytecode.INSTR_TRIM] = new Instruction("trim"); instructions[(int)Bytecode.INSTR_LENGTH] = new Instruction("length"); instructions[(int)Bytecode.INSTR_STRLEN] = new Instruction("strlen"); instructions[(int)Bytecode.INSTR_REVERSE] = new Instruction("reverse"); instructions[(int)Bytecode.INSTR_NOT] = new Instruction("not"); instructions[(int)Bytecode.INSTR_OR] = new Instruction("or"); instructions[(int)Bytecode.INSTR_AND] = new Instruction("and"); instructions[(int)Bytecode.INSTR_INDENT] = new Instruction("indent", OperandType.String); instructions[(int)Bytecode.INSTR_DEDENT] = new Instruction("dedent"); instructions[(int)Bytecode.INSTR_NEWLINE] = new Instruction("newline"); instructions[(int)Bytecode.INSTR_NOOP] = new Instruction("noop"); instructions[(int)Bytecode.INSTR_POP] = new Instruction("pop"); instructions[(int)Bytecode.INSTR_NULL] = new Instruction("null"); instructions[(int)Bytecode.INSTR_TRUE] = new Instruction("true"); instructions[(int)Bytecode.INSTR_FALSE] = new Instruction("false"); instructions[(int)Bytecode.INSTR_WRITE_STR] = new Instruction("write_str", OperandType.String); instructions[(int)Bytecode.INSTR_WRITE_LOCAL] = new Instruction("write_local", OperandType.Int); }
// // Private Methods // /// <summary> /// Used to get the max value of AZUL_KEYS enum /// </summary> /// <returns></returns> private int GetLargestValueInAzulKeysEnum() { int[] values = (int[])Enum.GetValues(typeof(Azul.AZUL_KEYS)); int highestValue = values[0]; for (int i = 1; i < values.Length; i++) { if (highestValue < values[i]) { highestValue = values[i]; } } return(highestValue); }
public void InvocationKindByParentReferenceKindTest() { // Arrange var helper = new ExpressionKindHelper(); // Assert foreach (ExpressionKind kind in Enum.GetValues(typeof(ExpressionKind))) { if (kind != ExpressionKind.TargetCall && kind != ExpressionKind.Target) { Assert.AreEqual(helper.InvocationKindByParentReferenceKind(kind), kind); } } }
public static void GetSupportedTextureFormats( out List <TranscodeFormatTuple> graphicsFormats, out List <KeyValuePair <TextureFormat, TranscodeFormat> > textureFormats ) { graphicsFormats = new List <TranscodeFormatTuple>(); textureFormats = new List <KeyValuePair <TextureFormat, TranscodeFormat> >(); var sb = new StringBuilder(); foreach (var formatInfo in allFormats) { var supported = SystemInfo.IsFormatSupported(formatInfo.formats.format, FormatUsage.Sample); if (supported) { graphicsFormats.Add(formatInfo.formats); } sb.AppendFormat("{0} support: {1}\n", formatInfo.formats.format, supported); } Debug.Log(sb.ToString()); sb.Clear(); GraphicsFormat[] allGfxFormats = (GraphicsFormat[])Enum.GetValues(typeof(GraphicsFormat)); foreach (var format in allGfxFormats) { sb.AppendFormat( "{0} sample:{1} blend:{2} getpixels:{3} linear:{4} loadstore:{5} aa2:{6} aa4:{7} aa8:{8} readpixels:{9} render:{10} setpixels:{11} sparse:{12}\n" , format , SystemInfo.IsFormatSupported(format, FormatUsage.Sample)?"1":"0" , SystemInfo.IsFormatSupported(format, FormatUsage.Blend)?"1":"0" , SystemInfo.IsFormatSupported(format, FormatUsage.GetPixels)?"1":"0" , SystemInfo.IsFormatSupported(format, FormatUsage.Linear)?"1":"0" , SystemInfo.IsFormatSupported(format, FormatUsage.LoadStore)?"1":"0" , SystemInfo.IsFormatSupported(format, FormatUsage.MSAA2x)?"1":"0" , SystemInfo.IsFormatSupported(format, FormatUsage.MSAA4x)?"1":"0" , SystemInfo.IsFormatSupported(format, FormatUsage.MSAA8x)?"1":"0" , SystemInfo.IsFormatSupported(format, FormatUsage.ReadPixels)?"1":"0" , SystemInfo.IsFormatSupported(format, FormatUsage.Render)?"1":"0" , SystemInfo.IsFormatSupported(format, FormatUsage.SetPixels)?"1":"0" , SystemInfo.IsFormatSupported(format, FormatUsage.Sparse)?"1":"0" ); } Debug.Log(sb.ToString()); }
private void ShowPaintModeAsGrid() { GSelectionGridArgs args0 = new GSelectionGridArgs(); args0.selectedIndex = (int)painter.Mode; args0.collection = Enum.GetValues(typeof(GFoliagePaintingMode)); args0.itemSize = GEditorCommon.selectionGridTileSizeWide; args0.itemPerRow = 2; args0.drawPreviewFunction = DrawModePreview; EditorGUI.BeginChangeCheck(); painter.Mode = (GFoliagePaintingMode)GEditorCommon.SelectionGrid(args0); if (EditorGUI.EndChangeCheck()) { RecordPaintModeAnalytics(); } if (painter.Mode == GFoliagePaintingMode.Custom) { GEditorCommon.Separator(); List <Type> customPainterTypes = GFoliagePainter.CustomPainterTypes; if (customPainterTypes.Count == 0) { EditorGUILayout.LabelField("No Custom Painter defined!", GEditorCommon.WordWrapItalicLabel); } else { GSelectionGridArgs args1 = new GSelectionGridArgs(); args1.selectedIndex = painter.CustomPainterIndex; args1.collection = customPainterTypes; args1.itemSize = GEditorCommon.selectionGridTileSizeWide; args1.itemPerRow = 2; args1.drawPreviewFunction = DrawCustomMode; painter.CustomPainterIndex = GEditorCommon.SelectionGrid(args1); GEditorCommon.Separator(); painter.CustomPainterArgs = EditorGUILayout.TextField("Custom Args", painter.CustomPainterArgs); } } }
public void ValueOfKindAsTypeOfKind_EatAnyValueKindTest() { // Arrange var helper = new ExpressionKindHelper(); // Assert foreach (ExpressionKind valueKind in Enum.GetValues(typeof(ExpressionKind))) { if (valueKind != ExpressionKind.TargetCall && valueKind != ExpressionKind.Result && valueKind != ExpressionKind.Mock && valueKind != ExpressionKind.Target) { foreach (ExpressionKind typeKind in Enum.GetValues(typeof(ExpressionKind))) { if (typeKind != ExpressionKind.Target) { Assert.AreEqual(helper.ValueOfKindAsTypeOfKind(valueKind, typeKind), valueKind); } } } } }