/// <summary> /// Gets the values. /// </summary> /// <returns></returns> public Dictionary<string, ValueExpression> GetValues() { Dictionary<string, ValueExpression> values = new Dictionary<string, ValueExpression>(); foreach (DataGridViewRow row in grdProperties.Rows) { string name = row.Cells[0].Value.ToString(); PropertyDefinition propDef = row.Cells[0].Tag as PropertyDefinition; if (row.Cells[1].Value != null) { string str = row.Cells[1].Value.ToString(); if (!string.IsNullOrEmpty(str)) { ValueExpression expr = null; if (propDef.PropertyType == PropertyType.PropertyType_DataProperty) { DataPropertyDefinition dp = propDef as DataPropertyDefinition; switch (dp.DataType) { case DataType.DataType_Boolean: expr = new BooleanValue(Convert.ToBoolean(str)); break; case DataType.DataType_Byte: expr = new ByteValue(Convert.ToByte(str)); break; case DataType.DataType_DateTime: expr = new DateTimeValue(Convert.ToDateTime(str)); break; case DataType.DataType_Decimal: expr = new DecimalValue(Convert.ToDouble(str)); break; case DataType.DataType_Double: expr = new DoubleValue(Convert.ToDouble(str)); break; case DataType.DataType_Int16: expr = new Int16Value(Convert.ToInt16(str)); break; case DataType.DataType_Int32: expr = new Int32Value(Convert.ToInt32(str)); break; case DataType.DataType_Int64: expr = new Int64Value(Convert.ToInt64(str)); break; case DataType.DataType_Single: expr = new SingleValue(Convert.ToSingle(str)); break; case DataType.DataType_String: expr = new StringValue(str); break; default: throw new NotSupportedException("Unsupported data type: " + dp.DataType); } } else if (propDef.PropertyType == PropertyType.PropertyType_GeometricProperty) { FdoGeometryFactory fact = FdoGeometryFactory.Instance; OSGeo.FDO.Geometry.IGeometry geom = fact.CreateGeometry(str); byte[] fgf = fact.GetFgf(geom); expr = new GeometryValue(fgf); geom.Dispose(); } if (expr != null) values.Add(name, expr); } } } return values; }
public void Bug520719() { // the following test should pass without Assert() in debug version. var int8 = new SByteValue(); int8.InnerText = "+10"; Assert.Equal(10, int8.Value); Assert.Equal("+10", int8.InnerText); var int16 = new Int16Value(); int16.InnerText = "+10"; Assert.Equal(10, int16.Value); Assert.Equal("+10", int16.InnerText); var int32 = new Int32Value(); int32.InnerText = "+10"; Assert.Equal(10, int32.Value); Assert.Equal("+10", int32.InnerText); var int64 = new Int64Value(); int64.InnerText = "+10"; Assert.Equal(10, int64.Value); Assert.Equal("+10", int64.InnerText); var integer = new IntegerValue(); integer.InnerText = "+10"; Assert.Equal(10, integer.Value); Assert.Equal("+10", integer.InnerText); var dec = new DecimalValue(); dec.InnerText = "+10"; Assert.Equal(10, dec.Value); Assert.Equal("+10", dec.InnerText); var single = new SingleValue(); single.InnerText = "+10"; Assert.Equal(10, single.Value); Assert.Equal("+10", single.InnerText); var dble = new DoubleValue(); dble.InnerText = "+10"; Assert.Equal(10, dble.Value); Assert.Equal("+10", dble.InnerText); }
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; }
protected virtual Title GenerateTitle(string text, Int32Value fontSize) { Title title1 = new Title(); ChartText chartText1 = new ChartText(); RichText richText1 = new RichText(); A::BodyProperties bodyProperties1 = new A::BodyProperties(); A::ListStyle listStyle1 = new A::ListStyle(); A::Paragraph paragraph1 = new A::Paragraph(); A::ParagraphProperties paragraphProperties1 = new A::ParagraphProperties(); A::DefaultRunProperties defaultRunProperties1 = new A::DefaultRunProperties() { Language = DEFAULT_LANG, FontSize = DEFAULT_FONT_SIZE }; paragraphProperties1.Append(defaultRunProperties1); A::Run run1 = new A::Run(); A::RunProperties runProperties1 = new A::RunProperties() { Language = DEFAULT_LANG, FontSize = fontSize }; A::Text text1 = new A::Text(); text1.Text = text; run1.Append(runProperties1); run1.Append(text1); paragraph1.Append(paragraphProperties1); paragraph1.Append(run1); richText1.Append(bodyProperties1); richText1.Append(listStyle1); richText1.Append(paragraph1); chartText1.Append(richText1); Layout layout1 = new Layout(); title1.Append(chartText1); title1.Append(layout1); return title1; }
private static DataValue ConvertInt32(Int32Value int32Value, DataType dataType, bool truncate) { switch (dataType) { case DataType.DataType_String: { return new StringValue(int32Value.Int32.ToString()); } case DataType.DataType_Single: { int i = int32Value.Int32; try { float f = Convert.ToSingle(i); return new SingleValue(f); } catch (OverflowException) { if (i > float.MaxValue) return new SingleValue(float.MaxValue); else if (i < float.MinValue) return new SingleValue(float.MinValue); else return new SingleValue((float)i); } } case DataType.DataType_Double: { int i = int32Value.Int32; try { double d = Convert.ToDouble(i); return new DoubleValue(d); } catch (OverflowException) { if (i > double.MaxValue) return new DoubleValue(double.MaxValue); else if (i < double.MinValue) return new DoubleValue(double.MinValue); else return new DoubleValue((double)i); } } case DataType.DataType_Decimal: { return new DecimalValue(Convert.ToDouble(int32Value.Int32)); } case DataType.DataType_Int16: { int i = int32Value.Int32; try { short f = Convert.ToInt16(i); return new Int16Value(f); } catch (OverflowException) { if (i > short.MaxValue) return new Int16Value(short.MaxValue); else if (i < short.MinValue) return new Int16Value(short.MinValue); else return new Int16Value((short)i); } } case DataType.DataType_Int64: { return new Int64Value(Convert.ToInt64(int32Value.Int32)); } default: return null; } }
public static Int32Value Clt_Un(Real8Value a, Real8Value b) { return(Int32Value.Create(CompareLt_Un(a, b))); }
public override void Process() { var titleRow = document.MainDocumentPart.Document.Body .Descendants <TableRow>().Where(o => o.Descendants <BookmarkStart>().Any(mark => mark.Name == DataProperty.TagID)).FirstOrDefault(); var sdtElements = titleRow.Descendants <SdtElement>().Where(o => o.SdtProperties.Descendants <SdtAlias>().Any(a => a.Val != null)).ToList(); var bookmarkStart = titleRow.Descendants <BookmarkStart>().Where(o => o.Name == DataProperty.TagID).FirstOrDefault(); List <string> properties = new List <string>(); for (int i = 0; i < sdtElements.Count; i++) { properties.Add(sdtElements[i].Descendants <SdtAlias>().FirstOrDefault().Val.Value); } TableRow curRow = titleRow; foreach (DCTWordDataObject wordDataObj in DataProperty.DataObjects) { TableRow newRow = curRow.InsertAfterSelf <TableRow>((TableRow)curRow.NextSibling <TableRow>().CloneNode(true)); TableCell firstCell = newRow.GetFirstChild <TableCell>(); int columnFirst = Int32Value.ToInt32(bookmarkStart.ColumnFirst); //== default(Int32Value) ? bookmarkStart.ColumnFirst.Value : 0; int columnLast = Int32Value.ToInt32(bookmarkStart.ColumnLast); for (int j = columnFirst; j <= columnLast; j++) { DCTDataProperty dataProperty = wordDataObj.PropertyCollection[properties[j - columnFirst]]; if (dataProperty is DCTSimpleProperty) { DCTSimpleProperty simpleProperty = dataProperty as DCTSimpleProperty; TableCell cell = getCellByIndex(firstCell, j); Paragraph p = cell.GetFirstChild <Paragraph>(); string strAlltext = simpleProperty.Value.ToString(); string[] splitArry = new string[] { "\r\n" }; string[] rows = strAlltext.Split(splitArry, StringSplitOptions.None); for (int i = 0; i < rows.Length; i++) { if (i == 0) { Run runElement = GetRunElement(p); FillText(ref runElement, GeneralFormatter.ToString(rows[i], simpleProperty.FormatString)); } else { Paragraph addrow = p.CloneNode(true) as Paragraph; Run addrunelement = GetRunElement(addrow); //addrow.GetFirstChild<Run>(); FillText(ref addrunelement, GeneralFormatter.ToString(rows[i], simpleProperty.FormatString)); p.InsertAfterSelf <Paragraph>(addrow); } } } } curRow = newRow; } }
public static Int32Value Clt(Real8Value a, Real8Value b) => Int32Value.Create(CompareLt(a, b));
public object ChangeType_Int32() { return(Int32Value.ChangeType(typeof(Int32), CultureInfo.InvariantCulture)); }
public static Int32Value Ceq(Real8Value a, Real8Value b) => Int32Value.Create(CompareEq(a, b));
public static Int32Value Cgt_Un(Real8Value a, Real8Value b) => Int32Value.Create(CompareGt_Un(a, b));
public static Int32Value Conv_Ovf_U4_Un(Real8Value a) => Int32Value.CreateUnknown();
public static Int32Value Conv_Ovf_U2(Real8Value a) => Int32Value.CreateUnknownUInt16();
internal Property_GraphX_TerminalSpacing(PropertyRoot owner) : base(owner) { Value = new Int32Value(this); }
public static Font CreateFont( Fonts fonts, DoubleValue fontSize, UInt32Value color, StringValue fontName, Int32Value fontFamilyNumbering, Int32Value fontCharSet, bool isBold, bool isItalic, bool isUnderline, FontSchemeValues? fontScheme = null) { var font = new Font(); font.Append(new FontSize { Val = fontSize }); font.Append(new Color { Theme = color }); font.Append(new FontName { Val = fontName }); font.Append(new FontFamilyNumbering { Val = fontFamilyNumbering }); font.Append(new FontCharSet { Val = fontCharSet }); if (fontScheme.HasValue) { font.Append(new FontScheme { Val = fontScheme.Value }); } if (isBold) { font.Append(new Bold()); } if (isItalic) { font.Append(new Italic()); } if (isUnderline) { font.Append(new Underline()); } fonts.Append(font); return font; }
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; // ST_TransitionCornerAndCenterDirectionType case 766: simpleValues[0] = new EnumValue <DocumentFormat.OpenXml.Presentation.TransitionCornerDirectionValues>(); simpleValues[1] = new EnumValue <DocumentFormat.OpenXml.Office2010.PowerPoint.TransitionCenterDirectionTypeValues>(); break; default: Debug.Assert(false); break; } Debug.Assert(simpleValues.Length > 0); return(simpleValues); }
public override async Task <Author> GetAuthorById(Int32Value request, ServerCallContext context) { return(EntityToDtoMapper.MapAuthor(await this.blogService.GetAuthorByIdAsync(request.Value))); }
/// <summary> /// Deletes the supplied sheet instance from the workbook part /// </summary> /// <param name="workbookPart">The workbook part to delete the sheet from</param> /// <param name="sheet">The sheet to delete</param> /// <exception cref="ArgumentNullException"> /// workbookPart /// or /// sheet /// </exception> public static void DeleteSheet(this WorkbookPart workbookPart, DocumentFormat.OpenXml.Spreadsheet.Sheet sheet) { if (workbookPart == null) { throw new ArgumentNullException("workbookPart"); } if (sheet == null) { throw new ArgumentNullException("sheet"); } // get the id of the sheet for deletion Int32Value sheetId = Int32Value.FromInt32((int)sheet.SheetId.Value); // Remove the sheet reference from the workbook. WorksheetPart worksheetPart = (WorksheetPart)(workbookPart.GetPartById(sheet.Id)); SheetViews views = worksheetPart.Worksheet.GetFirstChild <SheetViews>(); if (views != null) { views.Remove(); worksheetPart.Worksheet.Save(); } sheet.Remove(); // Delete the worksheet part. workbookPart.DeletePart(worksheetPart); // Get the CalculationChainPart // Note: An instance of this part type contains an ordered set of references to all cells in all worksheets in the // workbook whose value is calculated from any formula CalculationChainPart calChainPart = workbookPart.CalculationChainPart; if (calChainPart != null) { List <CalculationCell> forRemoval = new List <CalculationCell>(); var calChainEntries = calChainPart.CalculationChain.Descendants <CalculationCell>().ToList(); foreach (CalculationCell item in calChainEntries) { if (item.SheetId == null) { item.Remove(); } else if (item.SheetId.HasValue && item.SheetId.Value.Equals(sheetId)) { item.Remove(); } } if (calChainPart.CalculationChain.Count() == 0) { workbookPart.DeletePart(calChainPart); } } workbookPart.Workbook.Save(); }
public override async Task <Empty> DeleteTask(Int32Value request, ServerCallContext context) { await _dataAccess.DeleteTaskAsync(request.Value); return(new Empty()); }
public void TestAssertInInnerTextForPlusSymbol() { // same issue for SByteValue, Int16Value, IntegerValue, DecimalValue, SingleValue, DoubleValue { var v = new SByteValue(); v.InnerText = "+100"; sbyte v2 = v.Value; string t = v.InnerText; // Verify value and text Log.VerifyValue(v2, (sbyte)100, "{0}.Value", v.GetType().Name); Log.VerifyValue(t, "+100", "{0}.InnerText", v.GetType().Name); } { var v = new Int16Value(); v.InnerText = "+100"; Int16 v2 = v.Value; string t = v.InnerText; // Verify value and text Log.VerifyValue(v2, (Int16)100, "{0}.Value", v.GetType().Name); Log.VerifyValue(t, "+100", "{0}.InnerText", v.GetType().Name); } { var v = new Int32Value(); v.InnerText = "+100"; int v2 = v.Value; string t = v.InnerText; // Verify value and text Log.VerifyValue(v2, (int)100, "{0}.Value", v.GetType().Name); Log.VerifyValue(t, "+100", "{0}.InnerText", v.GetType().Name); } { var v = new IntegerValue(); v.InnerText = "+100"; long v2 = v.Value; string t = v.InnerText; // Verify value and text Log.VerifyValue(v2, (long)100, "{0}.Value", v.GetType().Name); Log.VerifyValue(t, "+100", "{0}.InnerText", v.GetType().Name); } { var v = new DecimalValue(); v.InnerText = "+100"; decimal v2 = v.Value; string t = v.InnerText; // Verify value and text Log.VerifyValue(v2, (decimal)100, "{0}.Value", v.GetType().Name); Log.VerifyValue(t, "+100", "{0}.InnerText", v.GetType().Name); } { var v = new SingleValue(); v.InnerText = "+100"; float v2 = v.Value; string t = v.InnerText; // Verify value and text Log.VerifyValue(v2, (float)100, "{0}.Value", v.GetType().Name); Log.VerifyValue(t, "+100", "{0}.InnerText", v.GetType().Name); } { var v = new DoubleValue(); v.InnerText = "+100"; double v2 = v.Value; string t = v.InnerText; // Verify value and text Log.VerifyValue(v2, (double)100, "{0}.Value", v.GetType().Name); Log.VerifyValue(t, "+100", "{0}.InnerText", v.GetType().Name); } }
internal Property_GraphX_SymbolSize(PropertyRoot owner) : base(owner) { Value = new Int32Value(this); }
public void OpenXmlSimpleTypeConverterTest() { // 1. Base64BinaryValue Base64BinaryValue base64 = new Base64BinaryValue(); base64 = "AA3322"; Assert.True("AA3322" == base64); Assert.Equal("AA3322", base64.Value); base64 = Base64BinaryValue.FromString("1234"); Assert.Equal("1234", base64.ToString()); Assert.Equal("1234", Base64BinaryValue.ToString(base64)); // 2. BooleanValue BooleanValue booleanValue = new BooleanValue(); booleanValue = true; Assert.True(booleanValue); Assert.True(booleanValue.Value); booleanValue = BooleanValue.FromBoolean(false); Assert.False(booleanValue); Assert.Equal(false, BooleanValue.ToBoolean(booleanValue)); // 3. ByteValue ByteValue byteValue = new ByteValue(); Byte bt = 1; byteValue = bt; Assert.True(bt == byteValue); Assert.Equal(bt, byteValue.Value); bt = 2; byteValue = ByteValue.FromByte(bt); Assert.Equal(bt, ByteValue.ToByte(byteValue)); // 4. DateTimeValue DateTimeValue dtValue = new DateTimeValue(); DateTime dt = DateTime.Now; dtValue = dt; Assert.True(dt == dtValue); dt = DateTime.Now.AddDays(1); dtValue = DateTimeValue.FromDateTime(dt); Assert.Equal(dt, dtValue.Value); Assert.Equal(dt, DateTimeValue.ToDateTime(dt)); // 5. DecimalValue DecimalValue decimalValue = new DecimalValue(); decimal dcm = 10; decimalValue = dcm; Assert.True(dcm == decimalValue); decimalValue = DecimalValue.FromDecimal(20); Assert.Equal(20, decimalValue.Value); Assert.Equal(20, DecimalValue.ToDecimal(decimalValue)); // 6. DoubleValue DoubleValue doubleValue = new DoubleValue(); double dbl = 1.1; doubleValue = dbl; Assert.True(dbl == doubleValue); doubleValue = DoubleValue.FromDouble(2.2); Assert.Equal(2.2, doubleValue.Value); Assert.Equal(2.2, DoubleValue.ToDouble(doubleValue)); // 7. HexBinaryValue HexBinaryValue hexBinaryValue = new HexBinaryValue(); string hex = "0X99CCFF"; hexBinaryValue = hex; Assert.True(hex == hexBinaryValue); hex = "111111"; hexBinaryValue = HexBinaryValue.FromString(hex); Assert.Equal(hex, hexBinaryValue.Value); Assert.Equal(hex, HexBinaryValue.ToString(hexBinaryValue)); // 8. Int16 Int16Value int16Value = new Int16Value(); Int16 int16 = 16; int16Value = int16; Assert.True(int16 == int16Value); int16 = 17; int16Value = Int16Value.FromInt16(int16); Assert.Equal(int16, int16Value.Value); Assert.Equal(int16, Int16Value.ToInt16(int16Value)); // 9. Int32 Int32Value int32Value = new Int32Value(); Int32 int32 = 32; int32Value = int32; Assert.True(int32 == int32Value); int32 = 33; int32Value = Int32Value.FromInt32(int32); Assert.Equal(int32, int32Value.Value); Assert.Equal(int32, Int32Value.ToInt32(int32Value)); // 10. Int64 Int64Value int64Value = new Int64Value(); Int64 int64 = 64; int64Value = int64; Assert.True(int64 == int64Value); int64 = 17; int64Value = Int64Value.FromInt64(int64); Assert.Equal(int64, int64Value.Value); Assert.Equal(int64, Int64Value.ToInt64(int64Value)); // 11. IntegerValue IntegerValue integerValue = new IntegerValue(); int integer = 64; integerValue = integer; Assert.True(integer == integerValue); integer = 17; integerValue = IntegerValue.FromInt64(integer); Assert.Equal(integer, integerValue.Value); Assert.Equal(integer, IntegerValue.ToInt64(integerValue)); // 12. OnOffValue OnOffValue onOffValue = new OnOffValue(); onOffValue = true; Assert.True(onOffValue); onOffValue = OnOffValue.FromBoolean(false); Assert.Equal(false, onOffValue.Value); Assert.Equal(false, OnOffValue.ToBoolean(onOffValue)); // 13. SByteValue SByteValue sbyteValue = new SByteValue(); SByte sbt = SByte.MaxValue; sbyteValue = sbt; Assert.True(sbt == sbyteValue); sbt = SByte.MinValue; sbyteValue = SByteValue.FromSByte(sbt); Assert.Equal(sbt, sbyteValue.Value); Assert.Equal(sbt, SByteValue.ToSByte(sbt)); // 14. SingleValue SingleValue singleValue = new SingleValue(); Single single = Single.MaxValue; singleValue = single; Assert.True(single == singleValue); single = Single.NaN; singleValue = SingleValue.FromSingle(single); Assert.Equal(single, singleValue.Value); Assert.Equal(single, SingleValue.ToSingle(singleValue)); // 15. StringValue StringValue stringValue = new StringValue(); String str = "Ethan"; stringValue = str; Assert.True(str == stringValue); str = "Yin"; stringValue = StringValue.FromString(str); Assert.Equal(str, stringValue.Value); Assert.Equal(str, stringValue.ToString()); Assert.Equal(str, StringValue.ToString(stringValue)); // 16. TrueFalseBlankValue TrueFalseBlankValue tfbValue = new TrueFalseBlankValue(); tfbValue = true; Assert.True(tfbValue); tfbValue = TrueFalseBlankValue.FromBoolean(false); Assert.Equal(false, tfbValue.Value); Assert.Equal(false, TrueFalseBlankValue.ToBoolean(tfbValue)); // 17. TrueFalseValue TrueFalseValue tfValue = new TrueFalseValue(); tfValue = true; Assert.True(tfValue); tfValue = TrueFalseValue.FromBoolean(false); Assert.Equal(false, tfValue.Value); Assert.Equal(false, TrueFalseValue.ToBoolean(tfValue)); // 18. UInt16Value UInt16Value uint16Value = new UInt16Value(); UInt16 uint16 = UInt16.MaxValue; uint16Value = uint16; Assert.True(uint16 == uint16Value); uint16 = UInt16.MinValue; uint16Value = UInt16Value.FromUInt16(uint16); Assert.Equal(uint16, uint16Value.Value); Assert.Equal(uint16, UInt16Value.ToUInt16(uint16Value)); // 19. UInt32Value UInt32Value uint32Value = new UInt32Value(); UInt32 uint32 = UInt32.MaxValue; uint32Value = uint32; Assert.True(uint32 == uint32Value); uint32 = UInt32.MinValue; uint32Value = UInt32Value.FromUInt32(uint32); Assert.Equal(uint32, uint32Value.Value); Assert.Equal(uint32, UInt32Value.ToUInt32(uint32Value)); // 20. UInt64Value UInt64Value uint64Value = new UInt64Value(); UInt64 uint64 = UInt64.MaxValue; uint64Value = uint64; Assert.True(uint64 == uint64Value); uint64 = UInt64.MinValue; uint64Value = UInt64Value.FromUInt64(uint64); Assert.Equal(uint64, uint64Value.Value); Assert.Equal(uint64, UInt64Value.ToUInt64(uint64Value)); }
public LocalNativeRecord(MgReader reader, FixedWKTReader mgReader, MgAgfReaderWriter agfRw, MgWktReaderWriter wktRw) { for (int i = 0; i < reader.GetPropertyCount(); i++) { string name = reader.GetPropertyName(i); _ordinalMap[i] = name; var pt = (PropertyValueType)reader.GetPropertyType(name); switch (pt) { case PropertyValueType.Blob: _values[name] = new BlobValue(); break; case PropertyValueType.Boolean: _values[name] = new BooleanValue(); break; case PropertyValueType.Byte: _values[name] = new ByteValue(); break; case PropertyValueType.Clob: _values[name] = new ClobValue(); break; case PropertyValueType.DateTime: _values[name] = new DateTimeValue(); break; case PropertyValueType.Double: _values[name] = new DoubleValue(); break; case PropertyValueType.Feature: _values[name] = new FeatureValue(); break; case PropertyValueType.Geometry: _values[name] = new GeometryValue(); break; case PropertyValueType.Int16: _values[name] = new Int16Value(); break; case PropertyValueType.Int32: _values[name] = new Int32Value(); break; case PropertyValueType.Int64: _values[name] = new Int64Value(); break; case PropertyValueType.Raster: _values[name] = new RasterValue(); break; case PropertyValueType.Single: _values[name] = new SingleValue(); break; case PropertyValueType.String: _values[name] = new StringValue(); break; } } for (int i = 0; i < reader.GetPropertyCount(); i++) { string name = _ordinalMap[i]; GetByteReaderMethod getblob = () => { return reader.GetBLOB(name); }; GetByteReaderMethod getclob = () => { return reader.GetCLOB(name); }; GetByteReaderMethod getgeom = () => { return reader.GetGeometry(name); }; if (!reader.IsNull(name)) { var pt = (PropertyValueType)reader.GetPropertyType(name); switch (pt) { case PropertyValueType.Blob: ((BlobValue)_values[name]).Value = Utility.StreamAsArray(new MgReadOnlyStream(getblob)); break; case PropertyValueType.Boolean: ((BooleanValue)_values[name]).Value = reader.GetBoolean(name); break; case PropertyValueType.Byte: ((ByteValue)_values[name]).Value = reader.GetByte(name); break; case PropertyValueType.Clob: byte [] b = Utility.StreamAsArray(new MgReadOnlyStream(getclob)); ((ClobValue)_values[name]).Value = Encoding.UTF8.GetChars(b); break; case PropertyValueType.DateTime: ((DateTimeValue)_values[name]).Value = Utility.ConvertMgDateTime(reader.GetDateTime(name)); break; case PropertyValueType.Double: ((DoubleValue)_values[name]).Value = reader.GetDouble(name); break; //case PropertyValueType.Feature: case PropertyValueType.Geometry: try { //TODO: See if SWIG issues come into play here var geom = agfRw.Read(reader.GetGeometry(name)); var wkt = wktRw.Write(geom); ((GeometryValue)_values[name]).Value = mgReader.Read(wkt); } catch //Invalid geometry fail! { ((GeometryValue)_values[name]).SetNull(); } break; case PropertyValueType.Int16: ((Int16Value)_values[name]).Value = reader.GetInt16(name); break; case PropertyValueType.Int32: ((Int32Value)_values[name]).Value = reader.GetInt32(name); break; case PropertyValueType.Int64: ((Int64Value)_values[name]).Value = reader.GetInt64(name); break; case PropertyValueType.Single: ((SingleValue)_values[name]).Value = reader.GetSingle(name); break; case PropertyValueType.String: ((StringValue)_values[name]).Value = reader.GetString(name); break; } } } }
public bool create() { int arrayIndex; Value array; object value; while (true) { var instr = method.Body.Instructions[index]; switch (instr.OpCode.Code) { case Code.Ret: return(true); case Code.Newarr: var arrayType = (TypeReference)instr.Operand; int arrayCount = ((Int32Value)emulator.pop()).value; if (arrayType.FullName == "System.Char") { emulator.push(new UserValue(new char[arrayCount])); } else { emulator.push(new UnknownValue()); } break; case Code.Call: case Code.Callvirt: if (!doCall(instr)) { return(false); } break; case Code.Ldelem_U1: arrayIndex = ((Int32Value)emulator.pop()).value; array = (Value)emulator.pop(); if (array is UserValue) { emulator.push(new Int32Value(((byte[])((UserValue)array).obj)[arrayIndex])); } else { emulator.push(Int32Value.createUnknownUInt8()); } break; case Code.Stelem_I1: value = emulator.pop(); arrayIndex = ((Int32Value)emulator.pop()).value; array = (Value)emulator.pop(); if (array is UserValue) { ((byte[])((UserValue)array).obj)[arrayIndex] = (byte)((Int32Value)value).value; } break; case Code.Stelem_I2: value = emulator.pop(); arrayIndex = ((Int32Value)emulator.pop()).value; array = (Value)emulator.pop(); if (array is UserValue) { ((char[])((UserValue)array).obj)[arrayIndex] = (char)((Int32Value)value).value; } break; case Code.Ldelem_Ref: arrayIndex = ((Int32Value)emulator.pop()).value; array = (Value)emulator.pop(); var userValue = array as UserValue; if (userValue != null && userValue.obj is string[]) { emulator.push(new StringValue(((string[])userValue.obj)[arrayIndex])); } else { emulator.push(new UnknownValue()); } break; case Code.Ldsfld: emulator.push(new UserValue((FieldReference)instr.Operand)); break; default: emulator.emulate(instr); break; } index++; } }
public static Table GetParagraph(ReportTable reportTable, Int32Value width) { Table table = new Table(); TableProperties tblProp = new TableProperties( new TableBorders( new TopBorder() { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 4 }, new BottomBorder() { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 4 }, new LeftBorder() { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 4 }, new RightBorder() { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 4 }, new InsideHorizontalBorder() { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 4 }, new InsideVerticalBorder() { Val = new EnumValue <BorderValues>(BorderValues.Single), Size = 4 } ) ); tblProp.TableWidth = new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto }; TableGrid tableGrid1 = new TableGrid(); GridColumn gridColumn1 = new GridColumn() { Width = width.ToString() }; GridColumn gridColumn2 = new GridColumn() { Width = width.ToString() }; GridColumn gridColumn3 = new GridColumn() { Width = width.ToString() }; tableGrid1.Append(gridColumn1); tableGrid1.Append(gridColumn2); tableGrid1.Append(gridColumn3); table.Append(tblProp); table.Append(tableGrid1); int count = reportTable.Value.Count; int cols = reportTable.Column; int j = 0; foreach (List <string> strs in reportTable.Value) { TableRow row = new TableRow(); for (int i = 0; i < cols; i++) { TableCell cell = new TableCell(); TableCellProperties tableCellProperties = new TableCellProperties(); TableCellMargin margin = new TableCellMargin(); margin.LeftMargin = new LeftMargin() { Width = "100", Type = TableWidthUnitValues.Dxa }; margin.RightMargin = new RightMargin() { Width = "100", Type = TableWidthUnitValues.Dxa }; tableCellProperties.Append(margin); Paragraph par = new Paragraph(); Run run = new Run(); if (j == 0 && reportTable.IsHaveColumn) { Shading shading1 = new Shading() { Val = ShadingPatternValues.Clear, Color = "auto", Fill = "AEAAAA", ThemeFill = ThemeColorValues.Background2, ThemeFillShade = "BF" }; RunProperties rPr = new RunProperties(); tableCellProperties.Append(shading1); rPr.Append(new Bold()); run.Append(rPr); } if (strs.Count != cols && i >= strs.Count - 1) { HorizontalMerge verticalMerge = new HorizontalMerge(); if (i == strs.Count - 1) { RunProperties rPr = new RunProperties(); rPr.Append(new Bold()); run.Append(rPr); verticalMerge.Val = MergedCellValues.Restart; run.Append(CreateText(strs[i])); } else { verticalMerge.Val = MergedCellValues.Continue; } tableCellProperties.Append(verticalMerge); } else { run.Append(CreateText(strs[i])); } par.Append(run); cell.Append(tableCellProperties); cell.Append(par); row.Append(cell); } j++; table.Append(row); } return(table); }
public XmlRecord(XmlProperty[] properties, FixedWKTReader wktReader, XmlNodeList propertyNodes, string nameElement, string valueElement) { for (int i = 0; i < properties.Length; i++) { string name = properties[i].Name; _ordinalMap[i] = name; switch (properties[i].Type) { case PropertyValueType.Blob: _values[name] = new BlobValue(); break; case PropertyValueType.Boolean: _values[name] = new BooleanValue(); break; case PropertyValueType.Byte: _values[name] = new ByteValue(); break; case PropertyValueType.Clob: _values[name] = new ClobValue(); break; case PropertyValueType.DateTime: _values[name] = new DateTimeValue(); break; case PropertyValueType.Double: _values[name] = new DoubleValue(); break; case PropertyValueType.Feature: _values[name] = new FeatureValue(); break; case PropertyValueType.Geometry: _values[name] = new GeometryValue(); break; case PropertyValueType.Int16: _values[name] = new Int16Value(); break; case PropertyValueType.Int32: _values[name] = new Int32Value(); break; case PropertyValueType.Int64: _values[name] = new Int64Value(); break; case PropertyValueType.Raster: _values[name] = new RasterValue(); break; case PropertyValueType.Single: _values[name] = new SingleValue(); break; case PropertyValueType.String: _values[name] = new StringValue(); break; } } foreach (XmlNode propNode in propertyNodes) { var name = propNode[nameElement].InnerText; var valueNode = propNode[valueElement]; if (valueNode != null) { var value = valueNode.InnerText; switch (_values[name].Type) { case PropertyValueType.Blob: ((BlobValue)_values[name]).Value = Encoding.UTF8.GetBytes(value); break; case PropertyValueType.Boolean: ((BooleanValue)_values[name]).Value = XmlConvert.ToBoolean(value); break; case PropertyValueType.Byte: ((ByteValue)_values[name]).Value = XmlConvert.ToByte(value); break; case PropertyValueType.Clob: ((ClobValue)_values[name]).Value = value.ToCharArray(); break; case PropertyValueType.DateTime: var dt = ConvertToDateTime(value); if (dt.HasValue) ((DateTimeValue)_values[name]).Value = dt.Value; break; case PropertyValueType.Double: ((DoubleValue)_values[name]).Value = XmlConvert.ToDouble(value); break; case PropertyValueType.Feature: ((FeatureValue)_values[name]).Value = ConvertToFeatures(value); break; case PropertyValueType.Geometry: ((GeometryValue)_values[name]).Value = wktReader.Read(value); break; case PropertyValueType.Int16: ((Int16Value)_values[name]).Value = XmlConvert.ToInt16(value); break; case PropertyValueType.Int32: ((Int32Value)_values[name]).Value = XmlConvert.ToInt32(value); break; case PropertyValueType.Int64: ((Int64Value)_values[name]).Value = XmlConvert.ToInt64(value); break; case PropertyValueType.Raster: ((RasterValue)_values[name]).Value = ConvertToRaster(value); break; case PropertyValueType.Single: ((SingleValue)_values[name]).Value = XmlConvert.ToSingle(value); break; case PropertyValueType.String: ((StringValue)_values[name]).Value = value; break; } } } }
public static Int32Value Conv_Ovf_U2(Real8Value a) { return(Int32Value.CreateUnknownUInt16()); }
internal static OpenXmlSimpleType CreateTargetValueObject(RedirectedRestriction redirectedRestriction) { OpenXmlSimpleType simpleValue = null; switch (redirectedRestriction.AttributeId) { // property name: Width case 2387: simpleValue = new UInt32Value(); break; // property name: VerticalSpace case 2389: simpleValue = new UInt32Value(); break; // property name: HorizontalSpace case 2390: simpleValue = new UInt32Value(); break; // property name: X case 2394: simpleValue = new Int32Value(); break; // property name: Y case 2396: simpleValue = new Int32Value(); break; // property name: Before case 2409: simpleValue = new UInt32Value(); break; // property name: After case 2412: simpleValue = new UInt32Value(); break; // property name: Line case 2415: simpleValue = new Int32Value(); break; // property name: Left case 2417: simpleValue = new Int32Value(); break; // property name: Start case 2418: simpleValue = new Int32Value(); break; // property name: Right case 2421: simpleValue = new Int32Value(); break; // property name: End case 2422: simpleValue = new Int32Value(); break; // property name: Hanging case 2425: simpleValue = new UInt32Value(); break; // property name: FirstLine case 2427: simpleValue = new UInt32Value(); break; // property name: Val case 2473: simpleValue = new Int32Value(); break; // property name: Val case 2474: simpleValue = new UInt32Value(); break; // property name: Width case 2589: simpleValue = new Int32Value(); break; // property name: Distance case 2643: simpleValue = new UInt32Value(); break; // property name: Space case 2650: simpleValue = new UInt32Value(); break; // property name: Val case 2680: simpleValue = new StringValue(); break; // property name: Width case 2686: simpleValue = new UInt32Value(); break; // property name: Space case 2687: simpleValue = new UInt32Value(); break; // property name: Width case 2704: simpleValue = new UInt32Value(); break; // property name: Val case 2732: simpleValue = new UInt32Value(); break; // property name: LegacySpace case 2738: simpleValue = new UInt32Value(); break; // property name: LegacyIndent case 2739: simpleValue = new Int32Value(); break; // property name: Val case 2769: simpleValue = new Int32Value(); break; // property name: Percent case 2847: simpleValue = new Int32Value(); break; // property name: Val case 2872: simpleValue = new HexBinaryValue(); break; // property name: FontSize case 2924: simpleValue = new Int32Value(); break; // property name: Val case 2986: simpleValue = new StringValue(); break; // property name: Delay case 2991: simpleValue = new StringValue(); break; // property name: ShapeId case 3071: simpleValue = new StringValue(); break; // property name: AutoAdvance case 3079: simpleValue = new StringValue(); break; // property name: ShapeId case 3080: simpleValue = new StringValue(); break; // property name: ShapeId case 3084: simpleValue = new StringValue(); break; // property name: ShapeId case 3089: simpleValue = new StringValue(); break; // property name: AdvanceAfterTime case 3150: simpleValue = new UInt32Value(); break; // property name: ShapeId case 3153: simpleValue = new StringValue(); break; default: Debug.Assert(false); break; } return simpleValue; }
public static Int32Value Conv_Ovf_U4_Un(Real8Value a) { return(Int32Value.CreateUnknown()); }
/// <summary> /// Delete a worksheet from excel doc /// </summary> /// <param name="doc">Spreadsheet document</param> /// <param name="sheetToDelete">Name of sheet to be deleted</param> public static void DeleteWorksheet(SpreadsheetDocument doc, string sheetToDelete) { WorkbookPart wbPart = doc.WorkbookPart; // Get the pivot Table Parts IEnumerable<PivotTableCacheDefinitionPart> pvtTableCacheParts = wbPart.PivotTableCacheDefinitionParts; var pvtTableCacheDefinationPart = new Dictionary<PivotTableCacheDefinitionPart, string>(); foreach (PivotTableCacheDefinitionPart item in pvtTableCacheParts) { PivotCacheDefinition pvtCacheDef = item.PivotCacheDefinition; //Check if this CacheSource is linked to SheetToDelete var pvtCahce = pvtCacheDef.Descendants<CacheSource>().Where(s => s.WorksheetSource.Sheet == sheetToDelete); if (pvtCahce.Count() > 0) { pvtTableCacheDefinationPart.Add(item, item.ToString()); } } foreach (var Item in pvtTableCacheDefinationPart) { wbPart.DeletePart(Item.Key); } //Get the SheetToDelete from workbook.xml Sheet theSheet = wbPart.Workbook.Descendants<Sheet>().FirstOrDefault(s => s.Name == sheetToDelete); if (theSheet == null) return; //Store the SheetID for the reference var sheetid = theSheet.SheetId; // Remove the sheet reference from the workbook. var worksheetPart = (WorksheetPart)(wbPart.GetPartById(theSheet.Id)); theSheet.Remove(); // Delete the worksheet part. wbPart.DeletePart(worksheetPart); //Get the DefinedNames var definedNames = wbPart.Workbook.Descendants<DefinedNames>().FirstOrDefault(); if (definedNames != null) { var defNamesToDelete = new List<DefinedName>(); foreach (DefinedName Item in definedNames) { // This condition checks to delete only those names which are part of Sheet in question if (Item.Text.Contains(sheetToDelete + "!")) defNamesToDelete.Add(Item); } foreach (DefinedName Item in defNamesToDelete) { Item.Remove(); } } // Get the CalculationChainPart //Note: An instance of this part type contains an ordered set of references to all cells in all worksheets in the //workbook whose value is calculated from any formula CalculationChainPart calChainPart; calChainPart = wbPart.CalculationChainPart; if (calChainPart != null) { var iSheetId = new Int32Value((int)sheetid.Value); var calChainEntries = calChainPart.CalculationChain.Descendants<CalculationCell>().Where(c => c.SheetId != null && c.SheetId.HasValue && c.SheetId.Value == iSheetId).ToList(); var calcsToDelete = new List<CalculationCell>(); foreach (CalculationCell Item in calChainEntries) { calcsToDelete.Add(Item); } foreach (CalculationCell Item in calcsToDelete) { Item.Remove(); } if (calChainPart.CalculationChain.Count() == 0) { wbPart.DeletePart(calChainPart); } } // Save the workbook. wbPart.Workbook.Save(); }
public static Int32Value Cgt(Real8Value a, Real8Value b) { return(Int32Value.Create(CompareGt(a, b))); }
private void Prepare(PropertyValueCollection propVals) { propVals.Clear(); currentValues.Clear(); // I do not trust the long-term stability of the PropertyValueCollection // // So what we do is load it up once with LiteralValue references and manipulate these // outside of the collection (via a cached dictionary). We cache everything from the wrapper API // that can be cached in the managed world so that we only have minimal contact with it // Omit read-only properties using (FdoFeatureService service = _conn.CreateFeatureService()) { ClassDefinition c = service.GetClassByName(this.ClassName); foreach (PropertyDefinition p in c.Properties) { string name = p.Name; PropertyValue pv = new PropertyValue(name, null); if (p.PropertyType == PropertyType.PropertyType_DataProperty) { DataPropertyDefinition d = p as DataPropertyDefinition; if (!d.ReadOnly && !d.IsAutoGenerated) { DataValue dv = null; switch (d.DataType) { case DataType.DataType_BLOB: dv = new BLOBValue(); break; case DataType.DataType_Boolean: dv = new BooleanValue(); break; case DataType.DataType_Byte: dv = new ByteValue(); break; case DataType.DataType_CLOB: dv = new CLOBValue(); break; case DataType.DataType_DateTime: dv = new DateTimeValue(); break; case DataType.DataType_Decimal: dv = new DecimalValue(); break; case DataType.DataType_Double: dv = new DoubleValue(); break; case DataType.DataType_Int16: dv = new Int16Value(); break; case DataType.DataType_Int32: dv = new Int32Value(); break; case DataType.DataType_Int64: dv = new Int64Value(); break; case DataType.DataType_Single: dv = new SingleValue(); break; case DataType.DataType_String: dv = new StringValue(); break; } if (dv != null) { pv.Value = dv; propVals.Add(pv); } } } else if (p.PropertyType == PropertyType.PropertyType_GeometricProperty) { GeometricPropertyDefinition g = p as GeometricPropertyDefinition; if (!g.ReadOnly) { GeometryValue gv = new GeometryValue(); pv.Value = gv; propVals.Add(pv); } } } c.Dispose(); } //Load property values into temp dictionary foreach (PropertyValue p in propVals) { currentValues[p.Name.Name] = p.Value as LiteralValue; } if (propertySnapshot == null) { propertySnapshot = new List<string>(); foreach (PropertyValue p in propVals) { propertySnapshot.Add(p.Name.Name); } } }
public override CalculateFeeCoefficients GetCalculateFeeCoefficientsForContract(Int32Value input) { if (input.Value == (int)FeeTypeEnum.Tx) { return(new CalculateFeeCoefficients()); } var targetTokenCoefficient = State.AllCalculateFeeCoefficients.Value.Value.FirstOrDefault(x => x.FeeTokenType == input.Value); return(targetTokenCoefficient); }