public TableInfo(string name, string primaryKeyName, ColumnType?primaryKeyType, short?primaryKeySize) { Name = name; PrimaryKeyName = primaryKeyName; PrimaryKeyType = primaryKeyType; PrimaryKeySize = primaryKeySize; }
public Column(Path path, ColumnType?type = null) { Path = path; _type = type ?? Parse(GetType()); _name = Snake(path); _nullable = Break(path); }
internal Object GetHoveredItem() { if (HoveredSlot.HasValue) { // Get the hovered Item Id and ColumnType int? ItemId = null; ColumnType?Column = null; foreach (var KVP in SlotBounds) { foreach (var KVP2 in KVP.Value) { if (KVP2.Value == HoveredSlot.Value) { ItemId = KVP.Key; Column = KVP2.Key; break; } } if (ItemId.HasValue && Column.HasValue) { break; } } if (ItemId.HasValue && Column.HasValue && Column != ColumnType.RowValue) { Object HoveredItem = Placeholders[ItemId.Value][ConvertColumnTypeToObjectQuality(Column.Value)]; return(HoveredItem); } else { return(null); } } else { return(null); } }
public static object ToColumnValue(this string value) { if (value == "true") { return(true); } if (value == "false") { return(false); } ColumnType?columnType = null; foreach (var c in value) { if (c >= '0' && c <= '9') { columnType ??= ColumnType.Integer; continue; } if (c == '.' && columnType == ColumnType.Integer) { columnType = ColumnType.Decimal; continue; } columnType = ColumnType.String; break; } columnType ??= ColumnType.String; return(columnType switch { ColumnType.Integer => long.Parse(value, CultureInfo.InvariantCulture), ColumnType.Decimal => decimal.Parse(value, CultureInfo.InvariantCulture), _ => value });
public Column(Expression expr, ColumnType?type = null) : this(new PathExtractor().Extract(expr), type) { }
public void DrawToolTips(SpriteBatch b) { if (IsEmptyMenu) { return; } // Draw tooltip over hovered item if (HoveredSlot.HasValue) { // Get the hovered Item Id and ColumnType int? ItemId = null; ColumnType?Column = null; foreach (var KVP in SlotBounds) { foreach (var KVP2 in KVP.Value) { if (KVP2.Value == HoveredSlot.Value) { ItemId = KVP.Key; Column = KVP2.Key; break; } } if (ItemId.HasValue && Column.HasValue) { break; } } if (ItemId.HasValue && Column.HasValue) { if (Column == ColumnType.RowValue) { List <Object> Items = Placeholders[ItemId.Value].Values.ToList(); List <int> Quantities = Items.Select(x => x.Stack).ToList(); List <int> SingleValues = Items.Select(x => ItemBag.GetSingleItemPrice(x)).ToList(); List <int> MultipliedValues = Items.Select(x => x.Stack * ItemBag.GetSingleItemPrice(x)).ToList(); // Compute how many digits each column needs so that we can align each number properly by making each number take up the maximum size of other numbers in the same column int SingleValueColumnDigits = SingleValues.Max(x => DrawHelpers.GetNumDigits(x)); int QuantityColumnDigits = Quantities.Max(x => DrawHelpers.GetNumDigits(x)); int MultipliedValueColumnDigits = MultipliedValues.Max(x => DrawHelpers.GetNumDigits(x)); float DigitScale = 3.0f; float SingleValueColumnWidth = SingleValueColumnDigits * DigitScale * DrawHelpers.TinyDigitBaseWidth; float QuantityColumnWidth = QuantityColumnDigits * DigitScale * DrawHelpers.TinyDigitBaseWidth; float MultipliedValueColumnWidth = MultipliedValueColumnDigits * DigitScale * DrawHelpers.TinyDigitBaseWidth; // Compute how big the tooltip needs to be int Margin = 32; int LineHeight = 28; int HorizontalSeparatorHeight = 6; int SeparatorMargin = 4; float PlusCharacterWidth = Game1.tinyFont.MeasureString("+").X; float MultiplyCharacterWidth = Game1.tinyFont.MeasureString("*").X; float EqualsCharacterWidth = Game1.tinyFont.MeasureString("=").X; float SpaceWidth = 7f; int TotalWidth = (int)(Margin + PlusCharacterWidth + SpaceWidth + SingleValueColumnWidth + SpaceWidth + MultiplyCharacterWidth + SpaceWidth + QuantityColumnWidth + SpaceWidth + EqualsCharacterWidth + SpaceWidth + MultipliedValueColumnWidth + Margin); int TotalHeight = (int)(Margin + Items.Count * LineHeight + SeparatorMargin + HorizontalSeparatorHeight + SeparatorMargin + LineHeight + Margin); // Ensure tooltip is fully visible on screen Rectangle ToolTipLocation = new Rectangle(HoveredSlot.Value.Right, HoveredSlot.Value.Top, TotalWidth, TotalHeight); if (ToolTipLocation.Right > Game1.viewport.Size.Width) { ToolTipLocation = new Rectangle(HoveredSlot.Value.Left - TotalWidth, HoveredSlot.Value.Top, TotalWidth, TotalHeight); } // Draw background DrawHelpers.DrawBox(b, ToolTipLocation); // Draw each row of values int ShadowOffset = 2; int CurrentYPosition = ToolTipLocation.Y + Margin; for (int i = 0; i < Items.Count; i++) { float CurrentXPosition = ToolTipLocation.X + Margin; if (i != 0) { DrawHelpers.DrawStringWithShadow(b, Game1.tinyFont, "+", CurrentXPosition, CurrentYPosition, Color.White, Color.Black, ShadowOffset, ShadowOffset); } CurrentXPosition += PlusCharacterWidth + SpaceWidth; Utility.drawTinyDigits(SingleValues[i], b, new Vector2(CurrentXPosition + SingleValueColumnWidth - DrawHelpers.MeasureNumber(SingleValues[i], DigitScale), CurrentYPosition), DigitScale, 1.0f, Color.White); CurrentXPosition += SingleValueColumnWidth + SpaceWidth; DrawHelpers.DrawStringWithShadow(b, Game1.tinyFont, "*", CurrentXPosition, CurrentYPosition + LineHeight / 4, Color.White, Color.Black, ShadowOffset, ShadowOffset); CurrentXPosition += MultiplyCharacterWidth + SpaceWidth; Utility.drawTinyDigits(Quantities[i], b, new Vector2(CurrentXPosition + QuantityColumnWidth - DrawHelpers.MeasureNumber(Quantities[i], DigitScale), CurrentYPosition), DigitScale, 1.0f, Color.White); CurrentXPosition += QuantityColumnWidth + SpaceWidth; DrawHelpers.DrawStringWithShadow(b, Game1.tinyFont, "=", CurrentXPosition, CurrentYPosition - LineHeight / 6, Color.White, Color.Black, ShadowOffset, ShadowOffset); CurrentXPosition += EqualsCharacterWidth + SpaceWidth; Utility.drawTinyDigits(MultipliedValues[i], b, new Vector2(CurrentXPosition + MultipliedValueColumnWidth - DrawHelpers.MeasureNumber(MultipliedValues[i], DigitScale), CurrentYPosition), DigitScale, 1.0f, Color.White); CurrentYPosition += LineHeight; } // Draw separator CurrentYPosition += SeparatorMargin; DrawHelpers.DrawHorizontalSeparator(b, ToolTipLocation.X + Margin, CurrentYPosition, TotalWidth - Margin * 2, HorizontalSeparatorHeight); CurrentYPosition += HorizontalSeparatorHeight + SeparatorMargin; // Draw total value int SummedValue = MultipliedValues.Sum(); float SummedValueWidth = DrawHelpers.MeasureNumber(SummedValue, DigitScale) + GoldIconSourceRect.Width * 2f + 8; Vector2 SummedValuePosition = new Vector2(ToolTipLocation.X + ((ToolTipLocation.Width - SummedValueWidth) / 2), CurrentYPosition + 6); Rectangle IconDestination = new Rectangle((int)SummedValuePosition.X, (int)(SummedValuePosition.Y + (DrawHelpers.TinyDigitBaseHeight * DigitScale - GoldIconSourceRect.Height * 2) / 2), GoldIconSourceRect.Width * 2, GoldIconSourceRect.Height * 2); b.Draw(GoldIconTexture, IconDestination, GoldIconSourceRect, Color.White); Utility.drawTinyDigits(SummedValue, b, new Vector2(SummedValuePosition.X + GoldIconSourceRect.Width * 2f + 8, SummedValuePosition.Y), DigitScale, 1.0f, GetValueColor(SummedValue)); } else { Object HoveredItem = Placeholders[ItemId.Value][ConvertColumnTypeToObjectQuality(Column.Value)]; Rectangle Location; if (IsNavigatingWithGamepad) { Location = HoveredSlot.Value; //new Rectangle(HoveredSlot.Value.Right, HoveredSlot.Value.Bottom, 1, 1); } else { Location = new Rectangle(Game1.getMouseX() - 8, Game1.getMouseY() + 36, 8 + 36, 1); } DrawHelpers.DrawToolTipInfo(b, Location, HoveredItem, true, true, true, true, true, true, Bag.MaxStackSize); } } } }
/// <summary> /// Sets the Type for the column. /// </summary> /// <param name="type"> the Type </param> /// <returns> the adds the column To sheet builder </returns> public virtual AddColumnBuilder SetType(ColumnType?type) { this.type = type; return(this); }
public ConstSqlExpression(object value, ColumnType?type = null) { Value = value; Type = type.HasValue ? type.Value : ColumnDefinition.FromType(value.GetType()); }
protected ColumnBuilder(string name, ColumnType columnType, short? size) { this.name = name; this.size = size; this.colType = columnType; }
protected ColumnBuilder(string name, ColumnType columnType) { this.name = name; this.colType = columnType; }
/// <summary> /// Sets the Type for the column. /// </summary> /// <param name="type"> the Type </param> /// <returns> the CreateSheetColumnBuilder </returns> public virtual CreateSheetColumnBuilder SetType(ColumnType? type) { this.type = type; return this; }
/// <summary> /// Sets the required properties for a Column. /// </summary> /// <param name="title"> must be unique within the Sheet </param> /// <param name="primary"> one and only one Column may be a Primary column </param> /// <param name="type"> must be set to TEXT_NUMBER if column is primary </param> public CreateSheetColumnBuilder(string title, bool? primary, ColumnType? type) { this.title = title; this.primary = primary; this.type = type; }
/// <summary> /// Sets the Type for the column. /// </summary> /// <param name="type"> the Type </param> /// <returns> the adds the column To sheet builder </returns> public virtual AddColumnBuilder SetType(ColumnType? type) { this.type = type; return this; }
/// <summary> /// Sets the required properties for adding a Column to a Sheet. /// </summary> /// <param name="title"> the Column title </param> /// <param name="index"> the Column index (zero-based) </param> /// <param name="type"> the Column Type </param> public AddColumnBuilder(string title, int? index, ColumnType? type) { this.title = title; this.index = index; this.type = type; }
/* Function: BuildCellContents */ protected void BuildCellContents(int parameterIndex, int cellIndex) { TokenIterator start = parameterTableSection.Start; start.Next(parameterTableTokenIndexes[parameterIndex, cellIndex] - start.TokenIndex); TokenIterator end = start; end.Next(parameterTableTokenIndexes[parameterIndex, cellIndex + 1] - end.TokenIndex); bool hadTrailingWhitespace = end.PreviousPastWhitespace(PreviousPastWhitespaceMode.EndingBounds, start); ColumnType type = ColumnOrder[cellIndex]; // Find the type of the next used cell ColumnType?nextType = null; for (int nextCellIndex = cellIndex + 1; nextCellIndex < NumberOfColumns; nextCellIndex++) { if (parameterTableColumnsUsed[nextCellIndex]) { nextType = ColumnOrder[nextCellIndex]; break; } } // Default value separators always get spaces before. Type-name separators get them if they're text (SQL's "AS") instead // of symbols (Pascal's ":"). if (type == ColumnType.DefaultValueSeparator || (type == ColumnType.TypeNameSeparator && start.FundamentalType == FundamentalType.Text)) { htmlOutput.Append(" "); } // We don't want syntax highlighting on the Name cell because identifiers can accidentally be marked as keywords with // simple highlighting and basic language support, such as "event" in "wxPaintEvent &event". if (type == ColumnType.Name) { htmlOutput.EntityEncodeAndAppend(start.TextBetween(end)); } else if (addLinks) { BuildTypeLinkedAndSyntaxHighlightedText(start, end, true, htmlOutput); } else { BuildSyntaxHighlightedText(start, end, htmlOutput); } // Default value separators and type/name separators always get spaces after. Make sure the spaces aren't duplicated // by the preceding cells. if (type == ColumnType.DefaultValueSeparator || type == ColumnType.TypeNameSeparator || (hadTrailingWhitespace && type != ColumnType.DefaultValue && nextType != ColumnType.DefaultValueSeparator && nextType != ColumnType.TypeNameSeparator)) { htmlOutput.Append(" "); } }
//internal ColumnType? ColumnType { get { return _columnType; } } /// <summary> /// type is a string key of field ("text"|"number"|"checkbox"|"select"|"textarea"|"control") in fields registry jsGrid.fields (the registry can be easily extended with custom field types). /// </summary> /// <param name="columnType"></param> /// <returns></returns> public Field SetColumnType(ColumnType columnType) { _columnType = columnType; return(this); }
public virtual Column Build(TableBuilder table, ISchemaProvider schemaProvider, IList<PostProcess> posts) { Column col; if (colType.HasValue) { col = new Column(name, colType.Value, false); } else { col = new Column(name, type); } if (colType.HasValue) { col.ColumnType = colType.Value; } if (size.HasValue) { col.Size = size.Value; } if (nullable.HasValue) { col.AllowNull = nullable.Value; } if (identity.HasValue) { col.IsIdentity = identity.Value; } if (unique.HasValue) { col.IsUnique = unique.Value; } colType = col.ColumnType; return col; }