public override void Save(TableData tableData) { tableData.Add(new DeckEntityData(this.transform.position, Name, Color, deckMeta, deckLayout, OwnerTakeAwayPermissionType, OwnerShufflePermissionType, OwnerDealPermissionType, OthersTakeAwayPermissionType, OthersShufflePermissionType, OthersDealPermissionType, false)); foreach (DeckEditor item in clonedDecks) { tableData.Add(new DeckEntityData(item.transform.position, Name, Color, deckMeta, deckLayout, OwnerTakeAwayPermissionType, OwnerShufflePermissionType, OwnerDealPermissionType, OthersTakeAwayPermissionType, OthersShufflePermissionType, OthersDealPermissionType, false)); } }
public override void Save(TableData tableData) { tableData.Add(new SingleZoneData(this.transform.position, Name, Color, OwnerTakeAwayPermissionType, OwnerDropOntoPermissionType, OwnerViewPermissionType, OthersTakeAwayPermissionType, OthersDropOntoPermissionType, OthersViewPermissionType, FlipCardsWhenDropped, CanOnlyHoldOneCard)); foreach (SingleZoneEditor item in clonedZones) { tableData.Add(new SingleZoneData(item.transform.position, Name, Color, OwnerTakeAwayPermissionType, OwnerDropOntoPermissionType, OwnerViewPermissionType, OthersTakeAwayPermissionType, OthersDropOntoPermissionType, OthersViewPermissionType, FlipCardsWhenDropped, CanOnlyHoldOneCard)); } }
private void SomethingDifferent(object sender, EventArgs e) { TableData.Clear(); if (SelectedLayout != null) { //Заполнить Layers согласно заданным строке и столбцу int colNum = Convert.ToInt32(СolumnNumberVM.NumValue) - 1; int startRowNum = Convert.ToInt32(RowNumberVM.NumValue) - 1; DataTable table = (DataTable)SelectedLayout; DataColumnCollection columns = table.Columns; if (columns.Count > colNum) { DataColumn column = table.Columns[colNum]; int currRowNum = 0; foreach (DataRow row in table.Rows) { if (currRowNum >= startRowNum) { TableData.Add(new LayerData() { Name = row[colNum].ToString() }); } currRowNum++; } } } SetResultLayerNames(); OnPropertyChanged("AcceptBtnIsEnabled"); }
/// <summary> /// Creates conversion tables from a .csv file. /// </summary> /// <param name="fileName">The name of the .csv file, including the extension.</param> public void LoadConversionTablesFromCSV(string fileName) { if (fileName.Substring(fileName.Length - 4).Equals(".csv")) { using (StreamReader file = new StreamReader(fileName)) { var conversionRowData = string.Empty; var lineBlock = new List <List <string> >(); while ((conversionRowData = file.ReadLine()) != null) { var lineData = Regex.Split(conversionRowData, @",").ToList(); if (lineData.All(conversionValue => conversionValue.Equals(string.Empty))) { TableData.Add(CreateConversionTable(lineBlock).Transpose()); lineBlock.Clear(); } else { lineBlock.Add(lineData); } } } } }
/// <summary> /// /// </summary> /// <param name="tableRowItem"></param> /// <param name="rowConverterParams"></param> /// <returns></returns> public IHTMLItem Convert(TableRowItem tableRowItem, RowConverterParamsV3 rowConverterParams) { if (tableRowItem == null) { throw new ArgumentNullException("tableRowItem"); } var tableRow = new TableRow(HTMLElementType.HTML5); foreach (var element in tableRowItem.Cells) { if (element is TableHeadingItem) { var th = element as TableHeadingItem; var cell = new TableHeaderCell(HTMLElementType.HTML5); var paragraphConverter = new ParagraphConverterV3(); var cellData = paragraphConverter.Convert(th, new ParagraphConverterParamsV3 { ResultType = ParagraphConvTargetEnumV3.Paragraph, Settings = rowConverterParams.Settings, StartSection = false }); if (cellData.SubElements() != null) { foreach (var subElement in cellData.SubElements()) { cell.Add(subElement); } } else { cell.Add(cellData); } //cell.Add(new SimpleHTML5Text { Text = th.Text }); if (th.ColSpan.HasValue) { cell.ColSpan.Value = th.ColSpan.ToString(); } if (th.RowSpan.HasValue) { cell.RowSpan.Value = th.RowSpan.ToString(); } switch (th.Align) { case TableAlignmentsEnum.Center: cell.Align.Value = "center"; break; case TableAlignmentsEnum.Left: cell.Align.Value = "left"; break; case TableAlignmentsEnum.Right: cell.Align.Value = "right"; break; } switch (th.VAlign) { case TableVAlignmentsEnum.Top: cell.VAlign.Value = "top"; break; case TableVAlignmentsEnum.Middle: cell.VAlign.Value = "middle"; break; case TableVAlignmentsEnum.Bottom: cell.VAlign.Value = "bottom"; break; } tableRow.Add(cell); } else if (element is TableCellItem) { var td = element as TableCellItem; var cell = new TableData(HTMLElementType.HTML5); var paragraphConverter = new ParagraphConverterV3(); var cellData = paragraphConverter.Convert(td, new ParagraphConverterParamsV3 { ResultType = ParagraphConvTargetEnumV3.Paragraph, Settings = rowConverterParams.Settings, StartSection = false }); if (cellData.SubElements() != null) { foreach (var subElement in cellData.SubElements()) { cell.Add(subElement); } } else { cell.Add(cellData); } //cell.Add(new SimpleHTML5Text { Text = td.Text }); if (td.ColSpan.HasValue) { cell.ColSpan.Value = td.ColSpan.ToString(); } if (td.RowSpan.HasValue) { cell.RowSpan.Value = td.RowSpan.ToString(); } switch (td.Align) { case TableAlignmentsEnum.Center: cell.Align.Value = "center"; break; case TableAlignmentsEnum.Left: cell.Align.Value = "left"; break; case TableAlignmentsEnum.Right: cell.Align.Value = "right"; break; } switch (td.VAlign) { case TableVAlignmentsEnum.Top: cell.VAlign.Value = "top"; break; case TableVAlignmentsEnum.Middle: cell.VAlign.Value = "middle"; break; case TableVAlignmentsEnum.Bottom: cell.VAlign.Value = "bottom"; break; } tableRow.Add(cell); } else { // invalid structure , we ignore Logger.Log.ErrorFormat("Invalid/unexpected table row sub element type : {0}", element.GetType()); //continue; } } tableRow.Align.Value = tableRowItem.Align ?? "left"; return(tableRow); }
private Block _formatPropertiesTable(string header, BplClass bplClass) { if (bplClass == null) return null; var table = new TableData("*", "*", "*", "4*"); table.Add((header == "Properties" ? "Property" : "Parameter"), "Type", "Characteristics", "Description"); IEnumerable<BplProperty> properties = null; if (OutputOptions.Has(BplDocumentationOptions.ShowInherited)) { properties = bplClass.Properties; } else { properties = bplClass.OwnProperties; } if (bplClass.Operation != null && ConsumerRole != null) { properties = properties.Where(_filterPropertiesByConsumer); } if (OutputOptions.Has(BplDocumentationOptions.SortMembers)) { properties = properties.OrderBy(p => p.Name); } var isGenericResult = bplClass.IsA(typeof(Result<>)) || bplClass.IsA(typeof(ResultSet<>)); var isGenericValue = bplClass.IsA(typeof(Value<>)) || bplClass.IsA(typeof(ValueSet<>)); foreach (var property in properties) { var name = property.Name.At(0).ToLower() + property.Name.After(0); var type = _formatDataType(property); var card = _cardinalityConverter.Convert(property); Section summary = null; if (isGenericResult) { summary = _formatDescription(property.ReferencedClass.ToCref()); } else if (isGenericValue) { if (property.PrimitiveType.UnderlyingType == typeof(bool)) { summary = _formatMarkup(null, new XElement("summary", "Indicates success/failure of the operation.")); } else { summary = _formatDescription(property.PrimitiveType.ToCref()); } } else { summary = _formatDescription(property.ToCref()); if (property.Class != bplClass) { var pclass = property.Class; if (_isEmpty(summary)) { summary = _formatDescription(pclass.GetProperty(property.Name).ToCref()); } _append(summary, new Run((_isEmpty(summary) ? "" : " ") + "Inherited from ")); _append(summary, _formatHyperlink(pclass.Name, pclass.ToCref())); _append(summary, new Run(".")); } } table.Add(name, type, card, summary); } var section = _createSection(); if (header.NotEmpty()) { section.Blocks.Add(_formatStyledParagraph("@SubTitle", header)); } if (table.RowCount == 1) { section.Blocks.Add(new Paragraph(new Run("None"))); } else { section.Blocks.Add(_formatHeaderedTable(table)); } return section; }
private Block _formatPrimitiveSynopsis(BplPrimitive primitive) { var datatype = primitive.UnderlyingType; var synopsis = new TableData(140, "Auto"); Action<string,string> addLine = (name, value) => synopsis.Add(name, value); Action addSpace = () => synopsis.Add(null, null); addLine("Schema:", primitive.Schema.NamespaceName); addLine("Tag Name:", primitive.TagName.LocalName); addSpace(); if (!primitive.IsEnum) { addLine("Xml Type:", BplLanguage.XmlConverters[primitive].XsdDefinition.ToString()); addSpace(); addLine("Json Type:", BplLanguage.JsonConverters[primitive].JsonDefinition.ToString()); addSpace(); addLine("Sql Type:", BplLanguage.SqlConverters[primitive].SqlDefinition.ToString()); if (primitive.UnitSymbol.NotEmpty()) { addSpace(); addLine("Unit:", primitive.UnitSymbol); } if (primitive.NormalizedForm.NotEmpty()) { addSpace(); addLine("Format:", primitive.NormalizedForm); } var operators = _formatDataOperators(datatype); if (operators != null) { addSpace(); synopsis.Add("Operators:", operators); } } return _formatPlainTable(synopsis); }
private Block _formatClassSynopsis(BplClass bplClass) { var synopsis = new TableData(140, "Auto"); synopsis.Add("Namespace:", _formatHyperlink(bplClass.Namespace)); synopsis.Add("Schema:", bplClass.Schema.NamespaceName); var operation = bplClass.Operation; if (operation != null) { synopsis.Add("Service:", operation.Service.Urn.NamespaceName); } if (bplClass.BaseClass != null) { synopsis.Add("Base Class:", (Inline)_formatHyperlink(bplClass.BaseClass)); } if (bplClass.DerivedClasses.Any()) { synopsis.Add("Derived Classes:", _formatHyperlinksRow(bplClass.DerivedClasses, "None").ToArray()); } if (!bplClass.Consumer.IsUnspecified) { synopsis.Add("Consumer(s):", bplClass.Consumer.ToString()); } if (!bplClass.Provider.IsUnspecified) { synopsis.Add("Provider:", bplClass.Provider.ToString()); } return _formatPlainTable(synopsis); }
private Section _formatPrimitiveSection(BplDocumentationTopic topic) { var primitive = topic.Primitive; var section = new Section(); Action<Block> add = block => { if (block != null) section.Blocks.Add(block); }; add(_formatStyledParagraph("@TopicHeader", topic.Title)); var markup = topic.Content; add(_formatSummary("@TopicSummary", markup)); add(_formatPrimitiveSynopsis(primitive)); if (primitive.IsEnum) { var table = new TableData(100, 250, "Auto"); table.Add("Value", "Name", "Description"); var enumType = primitive.UnderlyingType; foreach (var field in enumType.GetFields()) { if (field.IsSpecialName) continue; var enumName = field.Name; var enumValue = Convert.ToInt64(field.GetValue(null)); var enumDescr = _formatDescription(field.ToCref()); table.Add(enumValue.ToString(), enumName, enumDescr); } add(_formatHeaderedTable(table)); } add(_formatHyperlinksGroup("Used By", primitive.UsedBy.Select(p => p.Class))); return section; }
private Section _formatGlossarySection(BplDocumentationTopic topic) { var section = new Section(); Action<Block> add = block => { if (block != null) section.Blocks.Add(block); }; var table = new TableData(250, "Auto"); IEnumerable<BplPrimitive> primitives = null; if (topic.Name == "Primitives") { table.Add("Primitive", "Description"); primitives = BplLanguage.Primitives.Where(p => p.IsBrowsable && !p.IsArray && !p.IsNullable && !p.IsEnum); } else if (topic.Name == "Enumerations") { table.Add("Enumeration", "Description"); primitives = BplLanguage.Primitives.Where(p => p.IsBrowsable && p.IsEnum); } else { return null; } add(_formatStyledParagraph("@TopicHeader", topic.Title)); foreach (var primitive in primitives.OrderBy(p => p.Name)) { var name = _formatHyperlink(primitive); var desc = _formatDescription(primitive.ToCref()); table.Add(name, desc); } if (table.RowCount > 1) { add(_formatHeaderedTable(table)); } return section; }
private Block _formatNamespaceContents(string header, BplNamespace bplNamespace) { var table = new TableData(250, "Auto", 100); table.Add(header, "Description", "Type"); var bplClasses = bplNamespace.Classes.Where(c => c.IsBrowsable); if (ConsumerRole != null) { bplClasses = bplClasses.Where(_filterClassesByConsumer); } if (ProviderRole != null) { bplClasses = bplClasses.Where(_filterClassesByProvider); } if (ExcludedClasses != null) { bplClasses = bplClasses.Where(c => !ExcludedClasses.Contains(c)); } foreach (var bplClass in bplClasses.OrderBy(c => c.Name)) { var name = _formatHyperlink(bplClass); var type = _formatClassType(bplClass); var desc = _formatDescription(bplClass.ToCref()); table.Add(name, desc, type); } if (table.RowCount == 1) return null; return _formatHeaderedTable(table); }
private Section _formatNamespaceSection(BplDocumentationTopic topic) { var bplNamespace = topic.Namespace; var section = new Section(); Action<Block> add = block => { if (block != null) section.Blocks.Add(block); }; var synopsis = new TableData(140, "Auto"); synopsis.Add("Library:", _formatHyperlink(bplNamespace.Library)); synopsis.Add("Version:", bplNamespace.Version.ToString()); var contents = _formatNamespaceContents("Class", bplNamespace); add(_formatStyledParagraph("@TopicHeader", topic.Title)); add(_formatPlainTable(synopsis)); add(contents); return section; }
private Section _formatLibrarySection(BplDocumentationTopic topic) { var bplLibrary = topic.Library; var section = new Section(); Action<Block> add = block => { if (block != null) section.Blocks.Add(block); }; var synopsis = new TableData(140, "Auto"); synopsis.Add("Assembly:", bplLibrary.Assembly.GetName().Name + ".dll"); synopsis.Add("Version:", bplLibrary.Version.ToString()); add(_formatStyledParagraph("@TopicHeader", topic.Title)); add(_formatPlainTable(synopsis)); foreach (var bplNamespace in bplLibrary.Namespaces.OrderBy(ns => ns.Name)) { var contents = _formatNamespaceContents("Class", bplNamespace); if (contents != null) { add(_formatStyledParagraph("@SubTitle", bplNamespace.Name)); add(contents); } } return section; }