Exemplo n.º 1
0
		/// <summary>
		/// Copies the elements of the specified <see cref="EnumValue">EnumValue</see> array to the end of the collection.
		/// </summary>
		/// <param name="value">An array of type <see cref="EnumValue">EnumValue</see> containing the Components to add to the collection.</param>
		public void AddRange(EnumValue[] value) 
		{
			for (int i = 0;	(i < value.Length); i = (i + 1)) 
			{
				this.Add(value[i]);
			}
		}
        public string GetCellValue(OpenXmlPartContainer wbPart, EnumValue<CellValues> dataType, string value)
        {
            if (dataType != null)
            {
                switch (dataType.Value)
                {
                    case CellValues.SharedString:
                        var stringTable = wbPart.GetPartsOfType<SharedStringTablePart>().FirstOrDefault();
                        if (stringTable != null)
                        {
                            value = stringTable.SharedStringTable.ElementAt(int.Parse(value)).InnerText;
                        }
                        break;

                    case CellValues.Boolean:
                        switch (value)
                        {
                            case "0":
                                value = "False";
                                break;
                            default:
                                value = "True";
                                break;
                        }
                        break;
                }

            }

            return value;
        }
Exemplo n.º 3
0
 public GameRules(uint id, Client client) : base(id, client) {
     GameState = bindE<GameState>("DT_DOTAGamerules", "m_nGameState");
     GameTime = bind<float>("DT_DOTAGamerules", "m_fGameTime");
     HeroPickState = bind<uint>("DT_DOTAGamerules", "m_nHeroPickState");
     HeroPickStateTransitionTime = bind<float>("DT_DOTAGamerules", "m_flHeroPickStateTransitionTime");
     PreGameStartTime = bind<float>("DT_DOTAGamerules", "m_flPreGameStartTime");
 }
		public void CanUseEnumConstructorTest()
		{
			// Arrange
			var enumValue = new EnumValue<TestEnum>((Enum) Enum.Parse(typeof(TestEnum), "Value4"));

			// Assert
			Assert.AreEqual(TestEnum.Value4, enumValue.Value);
		}
 public GeneralTransferCorrectionSeller()
 {
     ExecutedFunction = new EnumValue
     {
         Code = 4,
         Name = "InvoiceAndTransferCorrection",
         Description = "КСЧФДИС"
     };
 }
        private EnumValue GetValue(EnumValue value)
        {
            foreach (EnumValue myValue in PossibleValues.Where(myValue => myValue.Equals(value)))
            {
                return myValue;
            }

            throw new ArgumentException("EnumValue is not contained in this enum.");
        }
Exemplo n.º 7
0
 public override MetaField CloneValue()
 {
     EnumData result = new EnumData(Name, Offset, FieldAddress, _type, _value, base.PluginLine);
     foreach (EnumValue option in Values)
     {
         EnumValue copiedValue = new EnumValue(option.Name, option.Value);
         result.Values.Add(copiedValue);
         if (_selectedValue != null && copiedValue.Value == _selectedValue.Value)
             result._selectedValue = copiedValue;
     }
     return result;
 }
 internal EnumValueCollection(EnumValueCollection other)
 {
     m_possibleValues = new List<EnumValue>();
     foreach(EnumValue val in other.m_possibleValues)
     {
         EnumValue newVal = new EnumValue();
         newVal.Value = val.Value;
         m_possibleValues.Add(newVal);
     }
     m_currentValue = GetValue(other.m_currentValue);
     m_sourceEnum = other.m_sourceEnum;
 }
Exemplo n.º 9
0
		/// <exception cref="ReservedNameException">
		/// The name is a reserved name.
		/// </exception>
		protected void AddValue(EnumValue newValue)
		{
			if (newValue != null) {
				foreach (EnumValue value in Values) {
					if (value.Name == newValue.Name)
						throw new ReservedNameException(newValue.Name);
				}

				values.Add(newValue);
				newValue.Modified += delegate { Changed(); };
				Changed();
			}
		}
Exemplo n.º 10
0
        public bool Equals(EnumValue other)
        {
            if (other != null && Value != null)
            {
                return Value.Equals(other.Value);
            }
            else if (other != null && Value == null && other.Value == null)
            {
                return true;
            }

            return false;
        }
 internal EnumValueCollection(Type enumType)
 {
     if (enumType.IsEnum)
     {
         m_possibleValues = new List<EnumValue>();
         foreach (string val in enumType.GetEnumNames())
         {
             EnumValue newVal = new EnumValue();
             newVal.Value = val;
             m_possibleValues.Add(newVal);
         }
         m_currentValue = m_possibleValues[0];
         m_sourceEnum = enumType.GetTraceLabQualifiedName();
     }
 }
Exemplo n.º 12
0
        internal void Set(EnumValue enumValue)
        {
            ignore_changes = true;
            Items.Clear();

            if (enumValue.Items == null || enumValue.Items.Count == 0)
            {
                if (enumValue.EnumType != null)
                {
                    if (enumValue.Items == null)
                        enumValue.Items = new Dictionary<int,string>();
                    else
                        enumValue.Items.Clear();

                    foreach (Enum x in Enum.GetValues(enumValue.EnumType))
                    {
                        int value = (int)Convert.ChangeType(x, typeof(int));
                        if(!enumValue.Items.ContainsKey(value))
                            enumValue.Items.Add(value, x.ToString());
                    }
                }
            }

            if (enumValue.Items != null && enumValue.Items.Count > 0)
            {
                int idx = -1;
                foreach (KeyValuePair<int,string> pair in enumValue.Items)
                {
                    idx++;
                    ComboBoxEnumItem li = new ComboBoxEnumItem(pair.Value, pair.Key);
                    Items.Add(li);
                    if (enumValue.ValueInt == pair.Key)
                        SelectedIndex = idx;
                }
            }
            ignore_changes = false;
        }
Exemplo n.º 13
0
		public EnumDescriptor (XmlElement elem)
		{
			string cls = elem.GetAttribute ("type");
			enumType = Registry.GetType (cls, true);
			this.name = enumType.FullName;
			
			values = new Hashtable ();

			// This gets the list of enum names and gets the value of each of them.
			// This is not done the other way (get the values, and then the names from them)
			// because it won't work if two different enum members have the same value
			ArrayList list = new ArrayList ();
			Hashtable evalues = new Hashtable ();
			foreach (string name in Enum.GetNames (enumType)) {
				object value = Enum.Parse (enumType, name);
				list.Add (value);
				evalues[name] = value;
			}

			foreach (XmlElement valueElem in elem.SelectNodes ("value")) {
				string name = valueElem.GetAttribute ("name");
				if (!evalues.Contains (name))
					throw new ArgumentException ("<enum> node for " + enumType.FullName + " contains extra element " + name);
				Enum value = (Enum)evalues[name];
				values[value] = new EnumValue (value,
							       valueElem.GetAttribute ("label"),
							       valueElem.GetAttribute ("description"));
				evalues.Remove (name);
			}
			
			// Remove from the array the values not declared in the xml file
			foreach (object val in evalues.Values)
				list.Remove (val);

			values_array = (Enum[]) list.ToArray (typeof(Enum));
		}
Exemplo n.º 14
0
 public static char GetChar(this Enum _enum) => EnumValue.GetChar(_enum);
Exemplo n.º 15
0
        public void SetHorizontalPosition(EnumValue<DW.HorizontalRelativePositionValues> relativeFrom, long? positionOffset, string horizontalAlignment = null, string percentagePositionHeightOffset = null)
        {
            // Horizontal Positioning
            // <wp:positionH relativeFrom="margin">
            //   <wp:posOffset>-38099</wp:posOffset>
            // </wp:positionH>
            // <wp:positionH relativeFrom="margin">
            //   <wp:align>left</wp:align>
            // </wp:positionH>
            // Horizontal Alignment (Ecma Office Open XML Part 1 - Fundamentals And Markup Language Reference.pdf - 20.4.3.1 page 3145)
            //   left, right, center, inside, outside

            _horizontalPosition = new DW.HorizontalPosition();
            // Horizontal Position Relative Base, <wp:positionH relativeFrom>
            // Margin - Page Margin ("margin"), Page - Page Edge ("page"), Column - Column ("column"), Character - Character ("character"), LeftMargin - Left Margin ("leftMargin"), RightMargin - Right Margin ("rightMargin")
            // InsideMargin - Inside Margin ("insideMargin"), OutsideMargin - Outside Margin ("outsideMargin")
            _horizontalPosition.RelativeFrom = relativeFrom;

            if (positionOffset != null)
                // Absolute Position Offset, <wp:posOffset>
                _horizontalPosition.PositionOffset = new DW.PositionOffset(positionOffset.ToString());

            if (horizontalAlignment != null)
                // Relative Horizontal Alignment, <wp:align>
                _horizontalPosition.HorizontalAlignment = new DW.HorizontalAlignment(horizontalAlignment);

            if (percentagePositionHeightOffset != null)
                // PercentagePositionHeightOffset, <wp14:pctPosHOffset>, available in Office2010 or above
                _horizontalPosition.PercentagePositionHeightOffset = new DW2010.PercentagePositionHeightOffset(percentagePositionHeightOffset);
        }
Exemplo n.º 16
0
 public static string GetString(this Enum _enum) => EnumValue.GetString(_enum);
Exemplo n.º 17
0
 public static object GetObject(this Enum _enum) => EnumValue.GetObject(_enum);
Exemplo n.º 18
0
        private JsonSchema GenerateInternal(Type type, Required valueRequired, bool required)
        {
            ValidationUtils.ArgumentNotNull((object)type, "type");
            string typeId1 = this.GetTypeId(type, false);
            string typeId2 = this.GetTypeId(type, true);

            if (!string.IsNullOrEmpty(typeId1))
            {
                JsonSchema schema = this._resolver.GetSchema(typeId1);
                if (schema != null)
                {
                    if (valueRequired != Required.Always && !JsonSchemaGenerator.HasFlag(schema.Type, JsonSchemaType.Null))
                    {
                        JsonSchema     jsonSchema = schema;
                        JsonSchemaType?type1      = jsonSchema.Type;
                        JsonSchemaType?nullable   = type1.HasValue ? new JsonSchemaType?(type1.GetValueOrDefault() | JsonSchemaType.Null) : new JsonSchemaType?();
                        jsonSchema.Type = nullable;
                    }
                    if (required)
                    {
                        bool?required1 = schema.Required;
                        if ((!required1.GetValueOrDefault() ? 1 : (!required1.HasValue ? 1 : 0)) != 0)
                        {
                            schema.Required = new bool?(true);
                        }
                    }
                    return(schema);
                }
            }
            if (Enumerable.Any <JsonSchemaGenerator.TypeSchema>((IEnumerable <JsonSchemaGenerator.TypeSchema>) this._stack, (Func <JsonSchemaGenerator.TypeSchema, bool>)(tc => tc.Type == type)))
            {
                throw new JsonException(StringUtils.FormatWith("Unresolved circular reference for type '{0}'. Explicitly define an Id for the type using a JsonObject/JsonArray attribute or automatically generate a type Id using the UndefinedSchemaIdHandling property.", (IFormatProvider)CultureInfo.InvariantCulture, (object)type));
            }
            JsonContract  jsonContract = this.ContractResolver.ResolveContract(type);
            JsonConverter jsonConverter;

            if ((jsonConverter = jsonContract.Converter) != null || (jsonConverter = jsonContract.InternalConverter) != null)
            {
                JsonSchema schema = jsonConverter.GetSchema();
                if (schema != null)
                {
                    return(schema);
                }
            }
            this.Push(new JsonSchemaGenerator.TypeSchema(type, new JsonSchema()));
            if (typeId2 != null)
            {
                this.CurrentSchema.Id = typeId2;
            }
            if (required)
            {
                this.CurrentSchema.Required = new bool?(true);
            }
            this.CurrentSchema.Title       = this.GetTitle(type);
            this.CurrentSchema.Description = this.GetDescription(type);
            if (jsonConverter != null)
            {
                this.CurrentSchema.Type = new JsonSchemaType?(JsonSchemaType.Any);
            }
            else
            {
                switch (jsonContract.ContractType)
                {
                case JsonContractType.Object:
                    this.CurrentSchema.Type = new JsonSchemaType?(this.AddNullType(JsonSchemaType.Object, valueRequired));
                    this.CurrentSchema.Id   = this.GetTypeId(type, false);
                    this.GenerateObjectSchema(type, (JsonObjectContract)jsonContract);
                    break;

                case JsonContractType.Array:
                    this.CurrentSchema.Type = new JsonSchemaType?(this.AddNullType(JsonSchemaType.Array, valueRequired));
                    this.CurrentSchema.Id   = this.GetTypeId(type, false);
                    JsonArrayAttribute jsonArrayAttribute = JsonTypeReflector.GetJsonContainerAttribute(type) as JsonArrayAttribute;
                    bool flag = jsonArrayAttribute == null || jsonArrayAttribute.AllowNullItems;
                    Type collectionItemType = ReflectionUtils.GetCollectionItemType(type);
                    if (collectionItemType != null)
                    {
                        this.CurrentSchema.Items = (IList <JsonSchema>) new List <JsonSchema>();
                        this.CurrentSchema.Items.Add(this.GenerateInternal(collectionItemType, !flag ? Required.Always : Required.Default, false));
                        break;
                    }
                    else
                    {
                        break;
                    }

                case JsonContractType.Primitive:
                    this.CurrentSchema.Type = new JsonSchemaType?(this.GetJsonSchemaType(type, valueRequired));
                    JsonSchemaType?type2 = this.CurrentSchema.Type;
                    if ((type2.GetValueOrDefault() != JsonSchemaType.Integer ? 0 : (type2.HasValue ? 1 : 0)) != 0 && TypeExtensions.IsEnum(type) && !type.IsDefined(typeof(FlagsAttribute), true))
                    {
                        this.CurrentSchema.Enum    = (IList <JToken>) new List <JToken>();
                        this.CurrentSchema.Options = (IDictionary <JToken, string>) new Dictionary <JToken, string>();
                        using (IEnumerator <EnumValue <long> > enumerator = EnumUtils.GetNamesAndValues <long>(type).GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                EnumValue <long> current = enumerator.Current;
                                JToken           key     = JToken.FromObject((object)current.Value);
                                this.CurrentSchema.Enum.Add(key);
                                this.CurrentSchema.Options.Add(key, current.Name);
                            }
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }

                case JsonContractType.String:
                    this.CurrentSchema.Type = new JsonSchemaType?(!ReflectionUtils.IsNullable(jsonContract.UnderlyingType) ? JsonSchemaType.String : this.AddNullType(JsonSchemaType.String, valueRequired));
                    break;

                case JsonContractType.Dictionary:
                    this.CurrentSchema.Type = new JsonSchemaType?(this.AddNullType(JsonSchemaType.Object, valueRequired));
                    Type keyType;
                    Type valueType;
                    ReflectionUtils.GetDictionaryKeyValueTypes(type, out keyType, out valueType);
                    if (keyType != null && ConvertUtils.IsConvertible(keyType))
                    {
                        this.CurrentSchema.AdditionalProperties = this.GenerateInternal(valueType, Required.Default, false);
                        break;
                    }
                    else
                    {
                        break;
                    }

                case JsonContractType.Serializable:
                    this.CurrentSchema.Type = new JsonSchemaType?(this.AddNullType(JsonSchemaType.Object, valueRequired));
                    this.CurrentSchema.Id   = this.GetTypeId(type, false);
                    this.GenerateISerializableContract(type, (JsonISerializableContract)jsonContract);
                    break;

                case JsonContractType.Linq:
                    this.CurrentSchema.Type = new JsonSchemaType?(JsonSchemaType.Any);
                    break;

                default:
                    throw new JsonException(StringUtils.FormatWith("Unexpected contract type: {0}", (IFormatProvider)CultureInfo.InvariantCulture, (object)jsonContract));
                }
            }
            return(this.Pop().Schema);
        }
Exemplo n.º 19
0
 public static int GetInt(this Enum _enum) => EnumValue.GetInt(_enum);
Exemplo n.º 20
0
 public GenerateTableCellWidth(Int32Value tableWidth)
 {
     this.width = tableWidth + "";
     this.type  = TableWidthUnitValues.Dxa;
 }
Exemplo n.º 21
0
 public static long GetLong(this Enum _enum) => EnumValue.GetLong(_enum);
Exemplo n.º 22
0
 public GenerateTableCellWidth()
 {
     this.width = "10682";
     this.type  = TableWidthUnitValues.Dxa;
 }
Exemplo n.º 23
0
 public GenerateTableCellWidth(StringValue width)
 {
     this.width = width ?? throw new ArgumentNullException(nameof(width));
     this.type  = TableWidthUnitValues.Dxa;
 }
Exemplo n.º 24
0
        public void WriteRow(List <string> cellValues, OpenExcelRowProperties rowProperties = default, EnumValue <CellValues> cellValueType = null)
        {
            WriteStartRow(rowProperties);

            if (cellValues != default)
            {
                foreach (var v in cellValues)
                {
                    WriteCell(v, new OpenExcelCellProperties {
                        DataType = cellValueType
                    });
                }
            }

            WriteEndRow();
        }
Exemplo n.º 25
0
 public FastFmtInstructionDef(EnumValue code, string mnemonic, IEnumValue flags)
 {
     Code     = code;
     Mnemonic = mnemonic;
     Flags    = flags;
 }
Exemplo n.º 26
0
 public static T GetObject <T>(this Enum _enum) => EnumValue.GetObject <T>(_enum);
Exemplo n.º 27
0
        //public void SetEffectExtent(long topEdge, long bottomEdge, long leftEdge, long rightEdge)
        //{
        //    _effectExtent = new DW.EffectExtent() { TopEdge = topEdge, BottomEdge = bottomEdge, LeftEdge = leftEdge, RightEdge = rightEdge };
        //}

        public void SetRelativeWidth(EnumValue<DW2010.SizeRelativeHorizontallyValues> relativeFrom, int percentageWidth)
        {
            _relativeWidth = new DW2010.RelativeWidth();
            // <wp14:sizeRelH relativeFrom>
            _relativeWidth.ObjectId = relativeFrom;
            // PercentageWidth, child <wp14:pctWidth>
            _relativeWidth.PercentageWidth = new DW2010.PercentageWidth(percentageWidth.ToString());
        }
Exemplo n.º 28
0
 public static decimal GetDecimal(this Enum _enum) => EnumValue.GetDecimal(_enum);
Exemplo n.º 29
0
 protected FormatterTableSerializer(object[][] infos, IdentifierConverter idConverter, EnumValue previousCtorKind)
 {
     this.infos            = infos;
     this.idConverter      = idConverter;
     this.previousCtorKind = previousCtorKind;
 }
Exemplo n.º 30
0
 public static double GetDouble(this Enum _enum) => EnumValue.GetDouble(_enum);
 protected override SpecificWand CreateRandomSpecificItem(EnumValue powerLevel, FloatRange budget)
 {
     return(SpecificWand.CreateRandom(powerLevel, ingredient, budget));
 }
Exemplo n.º 32
0
		/// <summary>
		/// Gets the index in the collection of the specified <see cref="EnumValueCollection">EnumValueCollection</see>, if it exists in the collection.
		/// </summary>
		/// <param name="value">The <see cref="EnumValueCollection">EnumValueCollection</see> to locate in the collection.</param>
		/// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
		public int IndexOf(EnumValue value) 
		{
			return this.List.IndexOf(value);
		}
Exemplo n.º 33
0
        private Stylesheet CreateStyleSheet()
        {
            var stylesheet = new Stylesheet();

            var fontNameRobotoRegular = "Roboto Regular";

            var fontSize10D = 10D;

            var fontColorBlue      = "FF099cce";
            var fontColorBlack     = "FF000000";
            var fontColorLightGrey = "FF404040";

            var fontBold = new Bold();

            #region Font 0 settings (10px, "RobotoRegular", "LightGrey") (RowsHeadersValuesEntity)

            var font0 = new Font();

            font0.Append(new FontSize {
                Val = fontSize10D
            });
            font0.Append(new FontName {
                Val = fontNameRobotoRegular
            });
            font0.Append(new Color {
                Rgb = HexBinaryValue.FromString(fontColorLightGrey)
            });

            #endregion

            #region Font 1 settings (10px, "RobotoRegular", "Blue") (RowHeaderNameTotalFor  + RowHeaderNameTotal + RowHeaderNameGroupByDefault )

            var font1 = new Font();

            font1.Append(new FontSize {
                Val = fontSize10D
            });
            font1.Append(new FontName {
                Val = fontNameRobotoRegular
            });
            font1.Append(new Color {
                Rgb = HexBinaryValue.FromString(fontColorBlue)
            });

            #endregion

            #region Font 2 settings (10px, "RobotoRegular", "Black") (Row period date)

            var font2 = new Font();

            font2.Append(new Bold());
            font2.Append(new FontSize {
                Val = fontSize10D
            });
            font2.Append(new FontName {
                Val = fontNameRobotoRegular
            });
            font2.Append(new Color {
                Rgb = HexBinaryValue.FromString(fontColorBlack)
            });

            #endregion

            #region Font 3 settings (10px, "RobotoRegular", "Black", bold) (Row entity headers names + Row total HeaderValue + Row totalFor HeaderValue)

            var font3 = new Font();

            //font3.Append(fontBold);
            font3.Append(new FontSize {
                Val = fontSize10D
            });
            font3.Append(new FontName {
                Val = fontNameRobotoRegular
            });
            font3.Append(new Color {
                Rgb = HexBinaryValue.FromString(fontColorBlack)
            });

            #endregion

            #region Add fonts, fills, borders.

            // Add Fonts.
            var fonts = new Fonts();
            fonts.Append(font0);
            fonts.Append(font1);
            fonts.Append(font2);
            fonts.Append(font3);

            // Add fills.
            var fill0 = new Fill();
            var fill1 = new Fill(); //
            var fill2 = new Fill(); //
            var fill3 = new Fill(); //
            var fill4 = new Fill(); //

            var fills = new Fills();
            fills.Append(fill0);
            fills.Append(fill1);
            fills.Append(fill2);
            fills.Append(fill3);
            fills.Append(fill4);

            #region (Nested headers) Fill 3 (grey)

            var backgroundColorLightGray = "FFf1f1f1"; //#f1f1f1
            var solidlightBlue           = new PatternFill
            {
                PatternType     = PatternValues.Solid,
                ForegroundColor = new ForegroundColor
                {
                    Rgb = HexBinaryValue.FromString(backgroundColorLightGray)
                }
            };
            //solidlightBlue.ForegroundColor = new ForegroundColor { Rgb = HexBinaryValue.FromString("FF099cce") };
            //solidlightBlue.BackgroundColor = new BackgroundColor { Indexed = 64 };
            fill3.PatternFill = solidlightBlue;

            #endregion

            #region (Nested rows) Fill 4 (white)

            var solidWhite = new PatternFill
            {
                //PatternType = PatternValues.Solid
                ForegroundColor = new ForegroundColor
                {
                    Rgb = HexBinaryValue.FromString("FFFFFFFF")
                }
            };
            //solidWhite.ForegroundColor = new ForegroundColor { Rgb = HexBinaryValue.FromString("FFFFFFFF") };
            //solidWhite.BackgroundColor = new BackgroundColor { Indexed = 64 };
            fill4.PatternFill = solidWhite;

            #endregion

            //#region (Nested headers) Fill 3 (blue)
            ////#f1f1f1
            //var solidlightBlue = new PatternFill
            //{
            //    PatternType = PatternValues.Solid,
            //    ForegroundColor = new ForegroundColor
            //    {
            //        Rgb = HexBinaryValue.FromString("FF099cce")
            //    }
            //};
            ////solidlightBlue.ForegroundColor = new ForegroundColor { Rgb = HexBinaryValue.FromString("FF099cce") };
            ////solidlightBlue.BackgroundColor = new BackgroundColor { Indexed = 64 };
            //fill3.PatternFill = solidlightBlue;

            //#endregion
            // Add Borders.
            var border0 = new Border();
            var borders = new Borders();
            borders.Append(border0);

            #endregion

            var verticalAligmentTop    = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Top);
            var verticalAligmentCenter = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Center);
            var verticalAligmentBottom = new EnumValue <VerticalAlignmentValues>(VerticalAlignmentValues.Bottom);

            // CellFormats.
            var cellformat0 = new CellFormat {
                FontId = 0, Alignment = new Alignment {
                    WrapText = true, Vertical = verticalAligmentCenter
                },                                                                                                                           /*FillId = 0,*/
            };                                                                                                                               // RowHeaderNameGroupByDefault  + RowHeaderNameTotal + RowHeaderNameTotalFor
            var cellformat1 = new CellFormat {
                FontId = 1, Alignment = new Alignment {
                    WrapText = true, Vertical = verticalAligmentCenter
                }
            };                                                                                                                                 // RowHeaderValueTotal + RowHeaderValueTotalFor
            var cellformat2 = new CellFormat {
                FontId = 2, Alignment = new Alignment {
                    WrapText = true, Vertical = verticalAligmentCenter
                }, FillId = 3,
            };                                                                                                                                               // RowHeaderNamesEntity
            var cellformat3 = new CellFormat {
                FontId = 2, Alignment = new Alignment {
                    WrapText = true, Vertical = verticalAligmentCenter
                }
            };                                                                                                                                 // RowsHeadersValuesEntity
            var cellformat4 = new CellFormat {
                FontId = 0, Alignment = new Alignment {
                    WrapText = true, Vertical = verticalAligmentCenter
                }
            };
            var cellformat5 = new CellFormat {
                FontId = 0, Alignment = new Alignment {
                    WrapText = true, Vertical = verticalAligmentCenter, Horizontal = HorizontalAlignmentValues.Left,
                }
            };                                                                                                                                                                               // (Nested rows, columns: Estimated, Actual)
            var cellformat6 = new CellFormat {
                FontId = 3, Alignment = new Alignment {
                    WrapText = true, Vertical = verticalAligmentCenter, Horizontal = HorizontalAlignmentValues.Left,
                }
            };                                                                                                                                                                               // RowTotal HeaderValue + TotalFor HeaderValue

            // Add CellFormats.
            var cellformats = new CellFormats();
            cellformats.Append(cellformat0);
            cellformats.Append(cellformat1);
            cellformats.Append(cellformat2);
            cellformats.Append(cellformat3);
            cellformats.Append(cellformat4);
            cellformats.Append(cellformat5);
            cellformats.Append(cellformat6);

            // Add FONTS, FILLS, BORDERS & CellFormats to stylesheet. (Preserve the ORDER)
            stylesheet.Append(fonts);
            stylesheet.Append(fills);
            stylesheet.Append(borders);
            stylesheet.Append(cellformats);

            return(stylesheet);
        }
Exemplo n.º 34
0
		public void Remove(EnumValue value) 
		{
			List.Remove(value);
		}
Exemplo n.º 35
0
 public static byte GetByte(this Enum _enum) => EnumValue.GetByte(_enum);
Exemplo n.º 36
0
		public int Add(EnumValue value) 
		{
			return this.List.Add(value);
		}
Exemplo n.º 37
0
 public PersonSememes(EnumGroupBase parent) : base(parent)
 {
     First  = new EnumValue(this);
     Second = new EnumValue(this);
     Third  = new EnumValue(this);
 }
Exemplo n.º 38
0
 public static bool GetBoolean(this Enum _enum) => EnumValue.GetBoolean(_enum);
Exemplo n.º 39
0
		public void RemoveValue(EnumValue value)
		{
			if (values.Remove(value))
				Changed();
		}
Exemplo n.º 40
0
        public static Table GetTable(DocumentTable model)
        {
            // Use the file name and path passed in as an argument
            // to open an existing Word 2007 document.

            // Create an empty table.
            Table table = new Table();

            var borderType = new EnumValue <BorderValues>(BorderValues.Single);

            var settings = GetDefaultSettings();

            var color = settings.BorderColor;

            // Create a TableProperties object and specify its border information.
            TableProperties tblProp = new TableProperties(

                new TableBorders(
                    new TopBorder()
            {
                Val   = borderType,
                Size  = settings.BorderSize,
                Color = new StringValue
                {
                    Value = color
                }
            },
                    new BottomBorder
            {
                Val   = borderType,
                Size  = settings.BorderSize,
                Color = new StringValue
                {
                    Value = color
                }
            },
                    new LeftBorder
            {
                Val   = borderType,
                Size  = settings.BorderSize,
                Color = new StringValue
                {
                    Value = color
                }
            },
                    new RightBorder
            {
                Val   = borderType,
                Size  = settings.BorderSize,
                Color = new StringValue
                {
                    Value = color
                }
            },
                    new InsideHorizontalBorder
            {
                Val   = borderType,
                Size  = settings.BorderSize,
                Color = new StringValue
                {
                    Value = color
                }
            },
                    new InsideVerticalBorder
            {
                Val   = borderType,
                Size  = settings.BorderSize,
                Color = new StringValue
                {
                    Value = color
                }
            }
                    ),
                new TableWidth
            {
                Type = new EnumValue <TableWidthUnitValues>(TableWidthUnitValues.Auto),
            }
                );

            // Append the TableProperties object to the empty table.
            table.AppendChild(tblProp);

            table.Append(AppendHeader(model, settings));

            foreach (var tr in model.Data)
            {
                table.Append(CreateTableRowWithSomeStyles(tr, settings.TableRowFontSize, settings.BoldTableRow));
            }

            return(table);
        }
Exemplo n.º 41
0
		/// <exception cref="BadSyntaxException">
		/// The name does not fit to the syntax.
		/// </exception>
		/// <exception cref="ReservedNameException">
		/// The name is a reserved name.
		/// </exception>
		public abstract EnumValue ModifyValue(EnumValue value, string declaration);
Exemplo n.º 42
0
 protected override void ExitEnumValue(PrinterContext context, EnumValue enumValue)
 {
     context.Append(enumValue.Name.Value);
 }
Exemplo n.º 43
0
		public void Insert(int index, EnumValue value)	
		{
			List.Insert(index, value);
		}
Exemplo n.º 44
0
		/// <summary>
		/// Gets a value indicating whether the collection contains the specified <see cref="EnumValueCollection">EnumValueCollection</see>.
		/// </summary>
		/// <param name="value">The <see cref="EnumValueCollection">EnumValueCollection</see> to search for in the collection.</param>
		/// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
		public bool Contains(EnumValue value) 
		{
			return this.List.Contains(value);
		}
Exemplo n.º 45
0
		/// <summary>
		/// Initializes a new instance of the <see cref="EnumValueCollection">EnumValueCollection</see> class containing the specified array of <see cref="EnumValue">EnumValue</see> Components.
		/// </summary>
		/// <param name="value">An array of <see cref="EnumValue">EnumValue</see> Components with which to initialize the collection. </param>
		public EnumValueCollection(EnumValue[] value)
		{
			this.AddRange(value);
		}
Exemplo n.º 46
0
		private void DrawItem(IGraphics g, EnumValue value, Rectangle record, Style style)
		{
			Font font = GetFont(style);
			string memberString = value.ToString();
			itemBrush.Color = style.EnumItemColor;

			if (style.UseIcons)
			{
				Image icon = Properties.Resources.EnumItem;
				g.DrawImage(icon, record.X, record.Y);

				Rectangle textBounds = new Rectangle(
					record.X + IconSpacing, record.Y,
					record.Width - IconSpacing, record.Height);

				g.DrawString(memberString, font, itemBrush, textBounds, memberFormat);
			}
			else
			{
				g.DrawString(memberString, font, itemBrush, record, memberFormat);
			}
		}
Exemplo n.º 47
0
 public static StaticMemberName GetEnumValueName(this EnumValue v)
 {
     return(new StaticMemberName(
                v.Enum.GetTypeName(),
                new TypeMemberName(v.Enum.Literals.First(l => l.Value == v.LiteralIntValue).Name)));
 }
Exemplo n.º 48
0
        /// <summary>
        ///     Method used to create a box
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public override BoxControl <IModelElement, IGraphicalDisplay, ModelArrow> CreateBox(IGraphicalDisplay model)
        {
            ModelControl retVal = null;

            NameSpace nameSpace = model as NameSpace;

            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            if (retVal == null && nameSpace != null)
            {
                retVal = new NameSpaceModelControl(this, nameSpace);
            }

            Variable variable = model as Variable;

            if (retVal == null && variable != null)
            {
                retVal = new VariableModelControl(this, variable);
            }

            Function function = model as Function;

            if (retVal == null && function != null)
            {
                retVal = new FunctionModelControl(this, function);
            }

            Parameter parameter = model as Parameter;

            if (retVal == null && parameter != null)
            {
                retVal = new ParameterModelControl(this, parameter);
            }

            Case cas = model as Case;

            if (retVal == null && cas != null)
            {
                retVal = new CaseModelControl(this, cas);
            }

            PreCondition preCondition = model as PreCondition;

            if (retVal == null && preCondition != null)
            {
                retVal = new PreConditionModelControl(this, preCondition);
            }

            Procedure procedure = model as Procedure;

            if (procedure != null)
            {
                retVal = new ProcedureModelControl(this, procedure);
            }

            Range range = model as Range;

            if (range != null)
            {
                retVal = new RangeModelControl(this, range);
            }

            Enum enumeration = model as Enum;

            if (enumeration != null)
            {
                retVal = new EnumModelControl(this, enumeration);
            }

            EnumValue value = model as EnumValue;

            if (value != null)
            {
                retVal = new EnumValueModelControl(this, value);
            }

            Collection collection = model as Collection;

            if (collection != null)
            {
                retVal = new CollectionModelControl(this, collection);
            }

            StateMachine stateMachine = model as StateMachine;

            if (stateMachine != null)
            {
                retVal = new StateMachineModelControl(this, stateMachine);
            }

            Structure structure = model as Structure;

            if (structure != null)
            {
                if (structure.IsAbstract)
                {
                    retVal = new InterfaceModelControl(this, structure);
                }
                else
                {
                    retVal = new StructureModelControl(this, structure);
                }
            }

            StructureElement element = model as StructureElement;

            if (element != null)
            {
                retVal = new StructureElementModelControl(this, element);
            }

            Rule rule = model as Rule;

            if (rule != null)
            {
                retVal = new RuleModelControl(this, rule);
            }

            RuleCondition ruleCondition = model as RuleCondition;

            if (ruleCondition != null)
            {
                retVal = new RuleConditionModelControl(this, ruleCondition);
            }

            Action action = model as Action;

            if (action != null)
            {
                retVal = new ActionModelControl(this, action);
            }

            return(retVal);
        }
Exemplo n.º 49
0
		/// <summary>
		/// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index.
		/// </summary>
		/// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param>
		/// <param name="index">The index of the array at which to begin inserting.</param>
		public void CopyTo(EnumValue[] array, int index) 
		{
			this.List.CopyTo(array, index);
		}
Exemplo n.º 50
0
 public TupleTypeInfo(EnumValue value, uint n, uint nbcst)
 {
     Value = value;
     N     = n;
     Nbcst = nbcst;
 }
Exemplo n.º 51
0
        /// <summary>
        /// Banned heros
        /// </summary>
        //todo: public RangeValue<uint> BannedHeros; 

        /// <summary>
        /// Selected heros
        /// </summary>
        //todo: public RangeValue<uint> SelectedHeros; 

        #endregion


        public GameRules(uint id, DotaGameState state) : base(id, state)
        {
            const string t = "DT_DOTAGamerules";

            GameState = bindE<DOTA_GameState>(t, "m_nGameState");
            GameTime = bind<float>(t, "m_fGameTime");
            GameStartTime = bind<float>(t, "m_flGameStartTime");
            GameEndTime = bind<float>(t, "m_flGameEndTime");
            PreGameStartTime = bind<float>(t, "m_flPreGameStartTime");
            //MatchID = bind<ulong>(t, "m_unMatchID"); broken
            GameMode = bindE<DOTA_GameMode>(t, "m_nGameState");
            PauseTeam = bindE<DOTA_ServerTeam>(t, "m_iPauseTeam");
            GameWinner = bindE<DOTA_ServerTeam>(t, "m_nGameWinner");
            NetTimeOfDay = bind<ulong>(t, "m_iNetTimeOfDay");
            DraftStartingTeam = bindE<DOTA_ServerTeam>(t, "m_iStartingTeam");
            DraftActiveTeam = bindE<DOTA_ServerTeam>(t, "m_iActiveTeam");
            HeroPickState = bindE<DOTA_HeroPickState>(t, "m_nHeroPickState");
            //ExtraTimeRemaining = bind<float>(t, "m_fExtraTimeRemaining"); broken

            //todo: BannedHeros = range<uint>("m_BannedHeroes", )
            //todo: handle m_nGGTeam and m_flGGEndsAtTime
        }
Exemplo n.º 52
0
        public void EnumValueTest()
        {
            EnumValue <M.BooleanValues> onoffEnum = new EnumValue <M.BooleanValues>();

            Assert.False(onoffEnum.HasValue);
            Assert.Null(onoffEnum.InnerText);
            Assert.Null(onoffEnum.ToString());

            onoffEnum.InnerText = "error value";
            Assert.False(onoffEnum.HasValue);
            Assert.Equal("error value", onoffEnum.InnerText);
            Assert.Equal("error value", onoffEnum.ToString());

            onoffEnum.InnerText = string.Empty;
            Assert.False(onoffEnum.HasValue);
            Assert.Equal(string.Empty, onoffEnum.InnerText);
            Assert.Equal(string.Empty, onoffEnum.ToString());

            onoffEnum.InnerText = "on";
            Assert.True(onoffEnum.HasValue);
            Assert.Equal("on", onoffEnum.InnerText);
            Assert.Equal(M.BooleanValues.On, onoffEnum.Value);
            Assert.Equal(M.BooleanValues.On, (M.BooleanValues)onoffEnum);
            Assert.Equal("on", onoffEnum.ToString());

            var newEnum = new EnumValue <M.BooleanValues>(onoffEnum);

            Assert.True(newEnum.HasValue);

            newEnum.Value = M.BooleanValues.Off;
            Assert.True(newEnum.HasValue);
            Assert.Equal("off", newEnum.InnerText);
            Assert.Equal(M.BooleanValues.Off, newEnum.Value);
            Assert.Equal(M.BooleanValues.Off, (M.BooleanValues)newEnum);
            Assert.Equal("off", newEnum.ToString());

            // the onoffEnum should not be changed.
            Assert.True(onoffEnum.HasValue);
            Assert.Equal("on", onoffEnum.InnerText);
            Assert.Equal(M.BooleanValues.On, onoffEnum.Value);
            Assert.Equal(M.BooleanValues.On, (M.BooleanValues)onoffEnum);
            Assert.Equal("on", onoffEnum.ToString());

            // test special case - the enum can be empty string ""
            var truefalseEmpty = new EnumValue <xvml.BooleanEntryWithBlankValues>(xvml.BooleanEntryWithBlankValues.Empty);

            Assert.True(truefalseEmpty.HasValue);
            Assert.Equal(string.Empty, truefalseEmpty.InnerText);
            Assert.Equal(xvml.BooleanEntryWithBlankValues.Empty, truefalseEmpty.Value);
            Assert.Equal(xvml.BooleanEntryWithBlankValues.Empty, (xvml.BooleanEntryWithBlankValues)truefalseEmpty);
            Assert.Equal(string.Empty, truefalseEmpty.ToString());

            truefalseEmpty = xvml.BooleanEntryWithBlankValues.T;
            Assert.True(truefalseEmpty.HasValue);
            Assert.Equal("t", truefalseEmpty.InnerText);
            Assert.Equal(xvml.BooleanEntryWithBlankValues.T, truefalseEmpty.Value);
            Assert.Equal(xvml.BooleanEntryWithBlankValues.T, (xvml.BooleanEntryWithBlankValues)truefalseEmpty);
            Assert.Equal("t", truefalseEmpty.ToString());

            truefalseEmpty.InnerText = string.Empty;
            Assert.True(truefalseEmpty.HasValue);
            Assert.Equal(string.Empty, truefalseEmpty.InnerText);
            Assert.Equal(xvml.BooleanEntryWithBlankValues.Empty, truefalseEmpty.Value);
            Assert.Equal(xvml.BooleanEntryWithBlankValues.Empty, (xvml.BooleanEntryWithBlankValues)truefalseEmpty);
            Assert.Equal(string.Empty, truefalseEmpty.ToString());

            // Clone constructor for EnumValue
            HeaderFooterValues validValue0 = HeaderFooterValues.Default;
            var objA = new EnumValue <HeaderFooterValues>(validValue0);
            var objB = new EnumValue <HeaderFooterValues>(objA);

            Assert.True(objA.HasValue);
            Assert.True(objB.HasValue);
            Assert.Equal("default", objA.InnerText);
            Assert.Equal("default", objB.InnerText);

            // Clone() for EnumValue.
            objA = new EnumValue <HeaderFooterValues>(validValue0);
            objB = (EnumValue <HeaderFooterValues>)objA.Clone();
            Assert.True(objA.HasValue);
            Assert.True(objB.HasValue);
            Assert.Equal("default", objA.InnerText);
            Assert.Equal("default", objB.InnerText);
        }
        public DynamicReconfigureStringDropdown(DynamicReconfigureInterface dynamic, ParamDescription pd, object def, object max, object min, string edit_method)
        {
            this.def = def;
            this.max = max;
            this.min = min;
            this.edit_method = edit_method.Replace("'enum'", "'Enum'");
            Dictionary<string, string> parsed = EnumParser.Parse(this.edit_method);
            string[] vals = parsed["Enum"].Split(new[] {'}'}, StringSplitOptions.RemoveEmptyEntries);
            List<Dictionary<string, string>> descs = vals.Select(s => EnumParser.SubParse(s + "}")).ToList();
            descs = descs.Except(descs.Where(d => d.Count == 0)).ToList();
            enumdescription = new EnumDescription();
            enumdescription.Enum = new EnumValue[descs.Count];
            enumdescription.enum_description = parsed["enum_description"];
            Type tdesc = typeof (EnumValue);

            for (int i = 0; i < descs.Count; i++)
            {
                Dictionary<string, string> desc = descs[i];
                EnumValue newval = new EnumValue();
                foreach (string s in desc.Keys)
                {
                    FieldInfo fi = tdesc.GetField(s);
                    if (fi.FieldType == typeof (int))
                        fi.SetValue(newval, int.Parse(desc[s]));
                    else
                        fi.SetValue(newval, desc[s]);
                }
                enumdescription.Enum[i] = newval;
            }
            name = pd.name.data;
            this.dynamic = dynamic;
            InitializeComponent();
            for (int i = 0; i < enumdescription.Enum.Length; i++)
            {
                if (!types.ContainsKey(enumdescription.Enum[i].type))
                {
                    throw new Exception("HANDLE " + enumdescription.Enum[i].type);
                }
                switch (types[enumdescription.Enum[i].type])
                {
                    case DROPDOWN_TYPE.INT:
                    {
                        ComboBoxItem cbi = new ComboBoxItem {Tag = int.Parse(enumdescription.Enum[i].value), Content = enumdescription.Enum[i].name, ToolTip = new ToolTip {Content = enumdescription.Enum[i].description + " (" + enumdescription.Enum[i].value + ")"}};
                        @enum.Items.Add(cbi);
                        if (i == 0)
                        {
                            @enum.SelectedValue = this.def;
                            dynamic.Subscribe(name, (Action<int>) changed);
                        }
                        else if (enumdescription.Enum[i].type != enumdescription.Enum[i - 1].type)
                            throw new Exception("NO CHANGSIES MINDSIES");
                    }
                        break;
                    case DROPDOWN_TYPE.STR:
                    {
                        ComboBoxItem cbi = new ComboBoxItem {Tag = enumdescription.Enum[i].value, Content = enumdescription.Enum[i].name, ToolTip = new ToolTip {Content = enumdescription.Enum[i].description}};
                        @enum.Items.Add(cbi);
                        if (i == 0)
                        {
                            @enum.SelectedValue = this.def;
                            dynamic.Subscribe(name, (Action<string>) changed);
                        }
                        else if (enumdescription.Enum[i].type != enumdescription.Enum[i - 1].type)
                            throw new Exception("NO CHANGSIES MINDSIES");
                    }
                        break;
                }
            }
            description.Content = name + ":";
            JustTheTip.Content = pd.description.data;
            ignore = false;
        }
Exemplo n.º 54
0
 public EnumValueView(EnumValue <T> content)
     : this()
 {
     Content = content;
 }
Exemplo n.º 55
0
        public void SetVerticalPosition(EnumValue<DW.VerticalRelativePositionValues> relativeFrom, long? positionOffset, string verticalAlignment = null, string percentagePositionVerticalOffset = null)
        {
            // <wp:positionV relativeFrom="paragraph">
            //   <wp:posOffset>723900</wp:posOffset>
            // </wp:positionV>
            // <wp:positionV relativeFrom="line">
            //   <wp:align>top</wp:align>
            // </wp:positionV>
            // Vertical Alignment (Ecma Office Open XML Part 1 - Fundamentals And Markup Language Reference.pdf - 20.4.3.2 page 3146)
            //   top, bottom, center, inside, outside

            // Vertical Positioning
            _verticalPosition = new DW.VerticalPosition();
            // Vertical Position Relative Base, <wp:positionV relativeFrom>
            _verticalPosition.RelativeFrom = relativeFrom;

            if (positionOffset != null)
                // PositionOffset, <wp:posOffset>
                _verticalPosition.PositionOffset = new DW.PositionOffset(positionOffset.ToString());

            if (verticalAlignment != null)
                // Relative Vertical Alignment, <wp:align>
                _verticalPosition.VerticalAlignment = new DW.VerticalAlignment(verticalAlignment);

            if (percentagePositionVerticalOffset != null)
                // PercentagePositionVerticalOffset <wp14:pctPosVOffset>, available in Office2010 or above
                _verticalPosition.PercentagePositionVerticalOffset = new DW2010.PercentagePositionVerticalOffset(percentagePositionVerticalOffset);
        }
Exemplo n.º 56
0
 public RegisterDef(EnumValue register, EnumValue baseRegister, EnumValue fullRegister32, EnumValue fullRegister, EnumValue registerClass, EnumValue registerKind, uint size, string name)
 {
     Register       = register;
     BaseRegister   = baseRegister;
     FullRegister32 = fullRegister32;
     FullRegister   = fullRegister;
     RegisterClass  = registerClass;
     RegisterKind   = registerKind;
     Size           = size;
     Index          = register.Value - baseRegister.Value;
     Name           = name;
 }
Exemplo n.º 57
0
 public void SetRelativeHeight(EnumValue<DW2010.SizeRelativeVerticallyValues> relativeFrom, int percentageHeight)
 {
     _relativeHeight = new DW2010.RelativeHeight();
     // <wp14:sizeRelV relativeFrom>
     _relativeHeight.RelativeFrom = relativeFrom;
     // PercentageHeight, child <wp14:pctHeight>
     _relativeHeight.PercentageHeight = new DW2010.PercentageHeight(percentageHeight.ToString());
 }
Exemplo n.º 58
0
        internal static OpenXmlSimpleType[] CreatePossibleMembers(UnionValueRestriction unionValueRestriction)
        {
            OpenXmlSimpleType[] simpleValues = new OpenXmlSimpleType[unionValueRestriction.UnionTypes.Length];

            switch (unionValueRestriction.UnionId)
            {
            // ST_AnimationDgmBuildType
            case 25:
                simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.Drawing.AnimationBuildValues>();
                simpleValues[1] = new EnumValue <DocumentFormat.OpenXml.Drawing.AnimationDiagramOnlyBuildValues>();
                break;

            // ST_AnimationChartBuildType
            case 27:
                simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.Drawing.AnimationBuildValues>();
                simpleValues[1] = new EnumValue <DocumentFormat.OpenXml.Drawing.AnimationChartOnlyBuildValues>();
                break;

            // ST_AdjCoordinate
            case 45:
                simpleValues[0] = new Int64Value();
                simpleValues[1] = new StringValue();
                break;

            // ST_AdjAngle
            case 46:
                simpleValues[0] = new Int32Value();
                simpleValues[1] = new StringValue();
                break;

            // ST_LayoutShapeType
            case 145:
                simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.Drawing.ShapeTypeValues>();
                simpleValues[1] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.OutputShapeValues>();
                break;

            // ST_ParameterVal
            case 183:
                simpleValues[0]  = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.HorizontalAlignmentValues>();
                simpleValues[1]  = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.VerticalAlignmentValues>();
                simpleValues[2]  = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.ChildDirectionValues>();
                simpleValues[3]  = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.ChildAlignmentValues>();
                simpleValues[4]  = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.SecondaryChildAlignmentValues>();
                simpleValues[5]  = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.LinearDirectionValues>();
                simpleValues[6]  = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.SecondaryLinearDirectionValues>();
                simpleValues[7]  = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.StartingElementValues>();
                simpleValues[8]  = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.BendPointValues>();
                simpleValues[9]  = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.ConnectorRoutingValues>();
                simpleValues[10] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.ArrowheadStyleValues>();
                simpleValues[11] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.ConnectorDimensionValues>();
                simpleValues[12] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.RotationPathValues>();
                simpleValues[13] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.CenterShapeMappingValues>();
                simpleValues[14] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.NodeHorizontalAlignmentValues>();
                simpleValues[15] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.NodeVerticalAlignmentValues>();
                simpleValues[16] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.FallbackDimensionValues>();
                simpleValues[17] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.TextDirectionValues>();
                simpleValues[18] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.PyramidAccentPositionValues>();
                simpleValues[19] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.PyramidAccentTextMarginValues>();
                simpleValues[20] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.TextBlockDirectionValues>();
                simpleValues[21] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.TextAnchorHorizontalValues>();
                simpleValues[22] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.TextAnchorVerticalValues>();
                simpleValues[23] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.TextAlignmentValues>();
                simpleValues[24] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.AutoTextRotationValues>();
                simpleValues[25] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.GrowDirectionValues>();
                simpleValues[26] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.FlowDirectionValues>();
                simpleValues[27] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.ContinueDirectionValues>();
                simpleValues[28] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.BreakpointValues>();
                simpleValues[29] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.OffsetValues>();
                simpleValues[30] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.HierarchyAlignmentValues>();
                simpleValues[31] = new Int32Value();
                simpleValues[32] = new DoubleValue();
                simpleValues[33] = new BooleanValue();
                simpleValues[34] = new StringValue();
                simpleValues[35] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.ConnectorPointValues>();
                break;

            // ST_ModelId
            case 184:
                simpleValues[0] = new Int32Value();
                simpleValues[1] = new StringValue();
                break;

            // ST_FunctionValue
            case 207:
                simpleValues[0] = new Int32Value();
                simpleValues[1] = new BooleanValue();
                simpleValues[2] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.DirectionValues>();
                simpleValues[3] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.HierarchyBranchStyleValues>();
                simpleValues[4] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.AnimateOneByOneValues>();
                simpleValues[5] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.AnimationLevelStringValues>();
                simpleValues[6] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.ResizeHandlesStringValues>();
                break;

            // ST_FunctionArgument
            case 209:
                simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.Drawing.Diagrams.VariableValues>();
                break;

            // ST_NonZeroDecimalNumber
            case 368:
                simpleValues[0] = new Int32Value();
                simpleValues[1] = new Int32Value();
                break;

            // ST_MarkupId
            case 375:
                simpleValues[0] = new Int32Value();
                simpleValues[1] = new Int32Value();
                break;

            // ST_HexColor
            case 404:
                simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.Wordprocessing.AutomaticColorValues>();
                simpleValues[1] = new HexBinaryValue();
                break;

            // ST_DecimalNumberOrPercent
            case 507:
                simpleValues[0] = new StringValue();
                simpleValues[1] = new Int32Value();
                break;

            // ST_SignedHpsMeasure_O14
            case 525:
                simpleValues[0] = new IntegerValue();
                simpleValues[1] = new StringValue();
                break;

            // ST_HpsMeasure_O14
            case 528:
                simpleValues[0] = new UInt32Value();
                simpleValues[1] = new StringValue();
                break;

            // ST_SignedTwipsMeasure_O14
            case 531:
                simpleValues[0] = new IntegerValue();
                simpleValues[1] = new StringValue();
                break;

            // ST_TwipsMeasure_O14
            case 534:
                simpleValues[0] = new UInt32Value();
                simpleValues[1] = new StringValue();
                break;

            // ST_TransitionEightDirectionType
            case 544:
                simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.Presentation.TransitionSlideDirectionValues>();
                simpleValues[1] = new EnumValue <DocumentFormat.OpenXml.Presentation.TransitionCornerDirectionValues>();
                break;

            // ST_TLTimeAnimateValueTime
            case 561:
                simpleValues[0] = new Int32Value();
                simpleValues[1] = new EnumValue <DocumentFormat.OpenXml.Presentation.IndefiniteTimeDeclarationValues>();
                break;

            // ST_TLTime_O12
            case 603:
                simpleValues[0] = new UInt32Value();
                simpleValues[1] = new EnumValue <DocumentFormat.OpenXml.Presentation.IndefiniteTimeDeclarationValues>();
                break;

            // ST_TLTime_O14
            case 604:
                simpleValues[0] = new StringValue();
                simpleValues[1] = new EnumValue <DocumentFormat.OpenXml.Presentation.IndefiniteTimeDeclarationValues>();
                break;

            // ST_PublishDate
            case 689:
                simpleValues[0] = new DateTimeValue();
                simpleValues[1] = new DateTimeValue();
                simpleValues[2] = new StringValue();
                break;

            // ST_ChannelDataPoint
            case 697:
                simpleValues[0] = new DecimalValue();
                simpleValues[1] = new BooleanValue();
                break;

            // ST_ChannelPropertyName
            case 701:
                simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.InkML.StandardChannelPropertyNameValues>();
                simpleValues[1] = new StringValue();
                break;

            // ST_BrushPropertyName
            case 704:
                simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.InkML.StandardBrushPropertyNameValues>();
                simpleValues[1] = new StringValue();
                break;

            // ST_ChannelName
            case 707:
                simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.InkML.StandardChannelNameValues>();
                simpleValues[1] = new StringValue();
                break;

            // ST_Units
            case 719:
                simpleValues[0]  = new EnumValue <DocumentFormat.OpenXml.InkML.StandardLengthUnitsValues>();
                simpleValues[1]  = new EnumValue <DocumentFormat.OpenXml.InkML.StandardPerLengthUnitsValues>();
                simpleValues[2]  = new EnumValue <DocumentFormat.OpenXml.InkML.StandardTimeUnitsValues>();
                simpleValues[3]  = new EnumValue <DocumentFormat.OpenXml.InkML.StandardPerTimeUnitsValues>();
                simpleValues[4]  = new EnumValue <DocumentFormat.OpenXml.InkML.StandardMassForceUnitsValues>();
                simpleValues[5]  = new EnumValue <DocumentFormat.OpenXml.InkML.StandardPerMassForceUnitsValues>();
                simpleValues[6]  = new EnumValue <DocumentFormat.OpenXml.InkML.StandardAngleUnitsValues>();
                simpleValues[7]  = new EnumValue <DocumentFormat.OpenXml.InkML.StandardPerAngleUnitsValues>();
                simpleValues[8]  = new EnumValue <DocumentFormat.OpenXml.InkML.StandardOtherUnitsValues>();
                simpleValues[9]  = new EnumValue <DocumentFormat.OpenXml.InkML.StandardPerOtherUnitsValues>();
                simpleValues[10] = new StringValue();
                break;

            // ST_BrushPropertyValue
            case 732:
                simpleValues[0] = new DecimalValue();
                simpleValues[1] = new BooleanValue();
                simpleValues[2] = new EnumValue <DocumentFormat.OpenXml.InkML.PenTipShapeValues>();
                simpleValues[3] = new EnumValue <DocumentFormat.OpenXml.InkML.RasterOperationValues>();
                simpleValues[4] = new StringValue();
                break;

            // ST_Ref
            case 746:
                simpleValues[0] = new StringValue();
                simpleValues[1] = new UInt32Value();
                break;

            // ST_CtxNodeType
            case 747:
                simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.Office2010.Ink.KnownContextNodeTypeValues>();
                simpleValues[1] = new StringValue();
                break;

            // ST_SemanticType
            case 750:
                simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.Office2010.Ink.KnownSemanticTypeValues>();
                simpleValues[1] = new UInt32Value();
                break;

            // ST_PointsOrInt
            case 753:
                simpleValues[0] = new ListValue <StringValue>();
                simpleValues[1] = new Int32Value();
                break;

            default:
                Debug.Assert(false);
                break;
            }

            Debug.Assert(simpleValues.Length > 0);

            return(simpleValues);
        }
Exemplo n.º 59
0
        public void VisitEnum(EnumData field)
        {
            SeekToOffset(field.Offset);
            switch (field.Type)
            {
                case EnumType.Enum8:
                    field.Value = (int)_reader.ReadSByte();
                    break;
                case EnumType.Enum16:
                    field.Value = (int)_reader.ReadInt16();
                    break;
                case EnumType.Enum32:
                    field.Value = _reader.ReadInt32();
                    break;
            }

            // Search for the corresponding option and select it
            EnumValue selected = null;
            foreach (EnumValue option in field.Values)
            {
                if (option.Value == field.Value)
                    selected = option;
            }
            if (selected == null)
            {
                // Nothing matched, so just add an option for it
                selected = new EnumValue(field.Value.ToString(), field.Value);
                field.Values.Add(selected);
            }
            field.SelectedValue = selected;
        }
Exemplo n.º 60
0
 protected override void HandleBind() => source = (EnumValue)RenderState.Source;