public override void WriteFieldSQL(FieldNode fieldNode, string sql) { base.WriteFieldSQL(fieldNode, sql); Emit(string.Format("print '<{0}>' + {1} + '</{0}>';" + Environment.NewLine, fieldNode.ObjectClassField.Name, sql)); if(fieldNode.ObjectClassField.Atts.GetBool("IsID") && !string.IsNullOrEmpty(fieldNode.ObjectClassField.Atts["Column"]) && !string.IsNullOrEmpty(fieldNode.ObjectClassField.Parent.Atts["Table"])) { undo.WriteIDField(fieldNode, string.Format("' + {0} + '", sql)); FlushUndo(); } }
public void WriteField(FieldNode fieldNode, string value) { if(fieldNode.ObjectClassField.Atts.GetBool("IsID") && !string.IsNullOrEmpty(fieldNode.ObjectClassField.Atts["Column"]) && !string.IsNullOrEmpty(fieldNode.ObjectClassField.Parent.Atts["Table"])) WriteIDField(fieldNode, Convert.ToString(Convert.ToInt32(value))); }
public virtual void Visit(FieldNode node) { node.Expression.Accept(this); node.Accept(Visitor); }
public FieldList(FieldNode fieldLeft) : base(fieldLeft, null) { }
public override void VisitField(FieldNode node) { visitor.VisitField((IFieldWithSymbols)node); }
public void WriteField(FieldNode fieldNode, string value) { int colIdx = 0; if(!colIdxs.TryGetValue(fieldNode, out colIdx)) { string fieldName = fieldNode.ObjectClassField.Name; string colName = string.Format("{0}{1}", fieldName, colNameCounts[fieldName]); //ws.Columns.get_Item(.... Name = colName colNameCounts.Inc(fieldName); } vals.Peek()[colIdx] = value; throw new Exception("The method or operation is not implemented."); }
internal OpLess(FieldNode field, ValueNode valueNode) : base(field, valueNode) { }
internal OpEqual(FieldNode field, ValueNode valueNode) : base(field, valueNode) { }
public BaseNode AddField(string id, string name, string type, string offset) { FieldNode fieldn = new FieldNode(id, name, type, offset); nodemap.Add(id, fieldn); return fieldn; }
/// <summary> /// 创建字段集合 /// </summary> /// <param name="ocDescription">要素类描述</param> /// <param name="tableStructureNode">表结构节点</param> /// <returns></returns> private IFields CreateFileds(TableStructureNode tableStructureNode, FeatureCodeNode featureCodeNode) { try { ///创建字段集合 IFeatureClassDescription fcDescription = new FeatureClassDescriptionClass(); IObjectClassDescription ocDescription = new ObjectClassDescriptionClass(); IFields fields = ocDescription.RequiredFields; //从配置文件读取图形类型 string sGeometryType = ""; Metadata.MetaTable pMetaTalbe = Metadata.MetaDataFile.MetaTabls[tableStructureNode.TableName] as Metadata.MetaTable; if (pMetaTalbe != null) { sGeometryType = Metadata.MetaDataFile.GraphConfig.GetGraphTypeMark(pMetaTalbe.Type); } //设置图形类型 if (sGeometryType != "NoneGeometry") { ocDescription = (IObjectClassDescription)fcDescription; fields = ocDescription.RequiredFields; int shapeFieldIndex = fields.FindField(fcDescription.ShapeFieldName); IField pGeometryfield = fields.get_Field(shapeFieldIndex); IGeometryDef geometryDef = pGeometryfield.GeometryDef; IGeometryDefEdit geometryDefEdit = (IGeometryDefEdit)geometryDef; if (sGeometryType == "Point") geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint; else if (sGeometryType == "Line") geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolyline; else if (sGeometryType == "Polygon") geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolygon; } IFieldsEdit fieldsEdit = fields as IFieldsEdit; // 遍历表结构数据 int FieldCount = tableStructureNode.FieldNodes.Count; for (int i = 0; i < FieldCount; i++) { IField field = new FieldClass(); IFieldEdit fieldEdit = (IFieldEdit)field; ///获取字段信息 FieldNode pFieldNode = tableStructureNode.FieldNodes[i]; if (pFieldNode != null) { ///设置字段值 fieldEdit.Name_2 = pFieldNode.FieldName; //从配置中获取别名 if (pMetaTalbe != null) fieldEdit.AliasName_2 = pMetaTalbe.GetFiledALisNameByCode(pFieldNode.FieldName); esriFieldType type = esriFieldType.esriFieldTypeString; switch (pFieldNode.FieldType) { case "Char": type = esriFieldType.esriFieldTypeString; break; case "Int": type = esriFieldType.esriFieldTypeInteger; break; case "Float": type = esriFieldType.esriFieldTypeDouble; break; case "Time": type = esriFieldType.esriFieldTypeDate; break; case "DateTime": type = esriFieldType.esriFieldTypeDate; break; case "Varchar": type = esriFieldType.esriFieldTypeString; break; case "Varbin": type = esriFieldType.esriFieldTypeString; break; default: break; } fieldEdit.Type_2 = type; fieldEdit.Length_2 = pFieldNode.FieldLength; fieldEdit.Precision_2 = pFieldNode.FieldPrecision; fieldsEdit.AddField(field); } } return fields; } catch(Exception ex) { LogAPI.WriteErrorLog(ex); return null; } }
public override TypeNode EvaluateType(API api, TypeNode type, bool isStatic) { if (identifier.ToString() == "students") { Console.Write(""); } TypeNode arrayType = null; try{ if (type == null) { FieldNode f = api.contextManager.findVariable(identifier.ToString()); if (f != null) { arrayType = f.type; if (f.isStatic == isStatic) { api.isNextStaticContext = false; } } else { arrayType = api.getTypeForIdentifier(identifier.ToString()); if (arrayType != null) { api.isNextStaticContext = true; } } } else { bool accept = false; if (!(type is ClassTypeNode)) { type = api.getTypeForIdentifier(type.ToString()); accept = true; } Context staticContext = api.buildContextForTypeDeclaration(type); FieldNode f = staticContext.findVariable(identifier.ToString(), Utils.privateLevel, Utils.protectedLevel); bool passed = f.isStatic == isStatic; if (accept) { passed = true; } if (f != null && passed) { arrayType = f.type; } } if (arrayType == null) { Utils.ThrowError("Array variable '" + identifier.ToString() + "' could not be found in the current context. "); } var arr = arrayType as ArrayTypeNode; int arraysOfArraysCounter = 0; while (arraysOfArraysCounter < arrayAccessList.Count) { if (arraysOfArraysCounter > arr.multidimsArrays.Count) { Utils.ThrowError("Cannot apply indexing with [] to an expression of type '" + arr.DataType.ToString() + "' [" + api.currentNamespace.Identifier.Name + "]"); } if (arr.multidimsArrays[arraysOfArraysCounter].dimensions != arrayAccessList[arraysOfArraysCounter].Count) { Utils.ThrowError("Wrong number of indices inside []; expected " + arr.multidimsArrays[arraysOfArraysCounter].dimensions + " [" + api.currentNamespace.Identifier.Name + "]"); } arraysOfArraysCounter++; } if (arraysOfArraysCounter == arr.multidimsArrays.Count) { arrayType = arr.DataType; } else { var dimensions = new List <MultidimensionArrayTypeNode>(); while (arraysOfArraysCounter < arr.multidimsArrays.Count) { dimensions.Add(new MultidimensionArrayTypeNode(arr.multidimsArrays[arraysOfArraysCounter].dimensions, null)); arraysOfArraysCounter++; } arrayType = new ArrayTypeNode(arr.DataType, dimensions, null); } }catch (SemanticException ex) { Utils.ThrowError(ex.Message + token.getLine()); } return(arrayType); }
public virtual FieldNode Visit(FieldNode node) { return(node); }
protected virtual ISyntaxVisitorAction Enter( FieldNode node, TContext context) => DefaultAction;
public NonNullViolation(FieldNode selection, Path path, IResultMap parent) { Selection = selection; Path = path; Parent = parent; }
public RemoteQueryBuilder SetRequestField(FieldNode field) { _requestField = field ?? throw new ArgumentNullException(nameof(field)); return(this); }
public void ProcessType(FieldNode fieldbase, string ntype) { BaseNode n; string type = ResolveType(ntype, out n, false); string dtype; if (typeDict.TryGetValue(type, out dtype)) { type = dtype; } if (prefix != null) sb.AppendLine(new String('\t', level) + prefix); if (n.Type() == typeof(UnionNode)) { UnionNode unode = n as UnionNode; if ( files[ unode.file ].StartsWith( @"G:\dev\C++\Open Steamworks" ) ) { string name = unode.name; if (name.Contains("$")) name = fieldbase.name; if (name.Length == 0) name = "value"; Console.WriteLine("Union"); sb.AppendLine(); sb.AppendLine(new String('\t', level) + "[StructLayout(LayoutKind.Explicit,CharSet=CharSet.Ansi,Pack=1,Size=" + unode.size + ")]"); sb.AppendLine(new String('\t', level) + "public struct Union" + name); sb.AppendLine(new String('\t', level) + "{"); prefix = "[FieldOffset(0)]"; level++; WriteToFile(unode); level--; prefix = null; sb.AppendLine(new String('\t', level) + "}"); sb.AppendLine(new String('\t', level) + "public Union" + name + " " + name + ";"); sb.AppendLine(); } } else if (n.Type() == typeof(ArrayTypeNode)) { ArrayTypeNode an = n as ArrayTypeNode; sb.AppendLine(new String('\t', level) + "[MarshalAs(UnmanagedType.ByValArray, SizeConst = " + (an.size / an.align) + ")]"); sb.AppendLine(new String('\t', level) + "public " + type + "[] " + fieldbase.name + ";"); } else { if (type == "bool") sb.AppendLine(new String('\t', level) + "[MarshalAs(UnmanagedType.I1)]"); sb.AppendLine(new String('\t', level) + "public " + type + " " + fieldbase.name + ";"); } }
internal OpEqual(FieldNode field, ValueNode valueNode) : base(field, valueNode) { }
internal OpBeginsWith(FieldNode field, ValueNode valueNode) : base(field, valueNode) { }
internal OpBeginsWith(FieldNode field, ValueNode valueNode) : base(field, valueNode) { }
protected virtual void VisitFieldNode(FieldNode node) { }
public override void WriteFieldSQL(FieldNode fieldNode, string sql) { if(sql.ToLower() == "null") throw new ApplicationException("Cannot output NULL field value"); writeQueue.Enqueue(fieldNode); Emit(string.Format("print '=' + cast({0} as varchar);" + Environment.NewLine, sql)); }
protected virtual ISyntaxVisitorAction Leave( FieldNode node, ISyntaxVisitorContext context) => DefaultAction;
internal CAMLOpLessEqual(FieldNode field, ValueNode valueNode) : base(field, valueNode) { }
public ArgumentError(string message, string argumentName, FieldNode fieldSelection) : base(message, fieldSelection) { ArgumentName = argumentName; }
public FieldList(FieldNode fieldLeft, FieldList fields) : base(fieldLeft, fields) { }
public void WriteField(FieldNode fieldNode, string value) { foreach(IWriter writer in writers) writer.WriteField(fieldNode, value); }
public CentralServerNode load(SystemInfo systemInfo) { CentralServerNode centralServerNode = csnFactory.CreateExport().Value; centralServerNode.Properties = CentralServerProperties.From(systemInfo.CentralServer); DatabasesFolderNode databasesFolderNode = dfnFactory.CreateExport().Value; foreach (var database in systemInfo.Databases.OrderBy(db => db.Name)) { DatabaseNode databaseNode = dfFactory.CreateExport().Value; databaseNode.DatabaseName = database.Name; if (database.Classes != null) { foreach (var @class in database.Classes.OrderBy(c => c.Name)) { var cn = new ClassNode(@class.Name, @class.Interface, @class.ParentClasses); foreach (var f in @class.Fields.OrderBy(f => f.Name)) { var fn = new FieldNode(f.Name, f.Type); cn.Children.Add(fn); } foreach (var m in @class.Methods.OrderBy(m => m)) { var mn = new MethodNode(m); cn.Children.Add(mn); } databaseNode.Children.Add(cn); } } databasesFolderNode.Children.Add(databaseNode); } centralServerNode.Children.Add(databasesFolderNode); DataServersFolderNode dataServersFolderNode = new DataServersFolderNode(); foreach (var dataServer in systemInfo.DataServer) { DataServerNode dataServerNode = dsnFactory.CreateExport().Value; dataServerNode.Properties = DataServerProperties.From(dataServer); //DatabasesFolderNode databasesFolderNode2 = dfnFactory.CreateExport().Value; //connectionService.DatabasesChanged += delegate(object s, EventArgs e) //{ // databasesFolderNode2.Children.Clear(); // foreach (string database in connectionService.Databases) // { // DatabaseNode databaseNode = new DatabaseNode(database); // databasesFolderNode2.Children.Add(databaseNode); // } //}; //foreach (string database in databasesList) //{ // DatabaseNode databaseNode = new DatabaseNode(database); // databasesFolderNode2.Children.Add(databaseNode); //} //dataServerNode.Children.Add(databasesFolderNode2); dataServersFolderNode.Children.Add(dataServerNode); } centralServerNode.Children.Add(dataServersFolderNode); return(centralServerNode); }
public override void Visit(FieldNode node) { base.Visit(node); Expression = Nodes.Pop() as FieldNode; }
/// <summary> /// Allows to compile the field resolver pipeline for a field. /// </summary> /// <param name="field">The field.</param> /// <param name="selection">The selection of the field.</param> /// <returns> /// Returns a <see cref="FieldDelegate" /> representing the field resolver pipeline. /// </returns> public FieldDelegate CompileResolverPipeline(IObjectField field, FieldNode selection) => _compileResolverPipeline(field, selection);
public override void WriteFieldSQL(FieldNode fieldNode, string sql) { }
public void WriteIDField(FieldNode fieldNode, string valueSQL) { string fmt = "insert into #objects(fk, class) values ({0}, '{1}');"; if(escape) fmt = fmt.Replace("'", "''"); tw.WriteLine(fmt, valueSQL, fieldNode.ObjectClassField.Parent.Name); idFields.TryAdd(fieldNode.ObjectClassField); }
public static QueryError CreateFieldError( string message, FieldNode fieldSelection) { return(CreateFieldError(message, null, fieldSelection)); }
public virtual void Visit(FieldNode node) { Nodes.Push(new FieldNode(Nodes.Pop(), node.FieldOrder, node.FieldName)); }
public void WriteField(FieldNode fieldNode, string value) { throw new NotSupportedException(); }
public Operation(FieldNode field, ValueNode valueNode) : base(field, valueNode) { }
public abstract void WriteFieldSQL(FieldNode fieldNode, string sql);
public void WriteField(FieldNode fieldNode, string value) { if(fieldNode.ShouldWrite && fieldNode.CurrentObject.ShouldWrite) xw.WriteElementString(fieldNode.ObjectClassField.Name, value); }
CreateFieldDefCommand(TypeNode ownerNode, FieldDefOptions options) { this.ownerNode = ownerNode; fieldNode = ownerNode.Create(options.CreateFieldDef(ownerNode.TypeDef.Module)); }
internal OpGreater(FieldNode field, ValueNode valueNode) : base(field, valueNode) { }
/// <summary> /// Executes the actual exporting. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void exporter_DoWork(object sender, DoWorkEventArgs e) { FieldDefinition fieldDefinition = FieldDefinition.Factory(Guid.NewGuid(), Program.ASSEMBLY_DOCUMENT.DisplayName); foreach (PropertySet ps in LegacyInterchange.PropSets /*Program.MAINWINDOW.GetPropertySetsTabControl().TranslateToPropertySets()*/) { fieldDefinition.AddPropertySet(ps); } SurfaceExporter surfaceExporter = new SurfaceExporter(); List <string> exportedMeshes = new List <string>(); List <string> exportedColliders = new List <string>(); StringBuilder pathBuilder = new StringBuilder(); int numOccurrences = Program.ASSEMBLY_DOCUMENT.ComponentDefinition.Occurrences.AllLeafOccurrences.Count; int progressPercent = 0; int currentOccurrenceID = 0; foreach (ComponentOccurrence currentOccurrence in Program.ASSEMBLY_DOCUMENT.ComponentDefinition.Occurrences.AllLeafOccurrences) { if (exporter.CancellationPending) { e.Cancel = true; return; } progressPercent = (int)Math.Floor((currentOccurrenceID / (double)numOccurrences) * 100.0); exporter.ReportProgress(progressPercent, "Exporting... " + progressPercent + "%"); if (currentOccurrence.Visible && currentOccurrence.ReferencedDocumentDescriptor != null && currentOccurrence.ReferencedDocumentDescriptor.ReferencedDocumentType == DocumentTypeEnum.kPartDocumentObject && currentOccurrence.SurfaceBodies.Count > 0) { FieldNode outputNode = new FieldNode(currentOccurrence.Name); outputNode.Position = Utilities.ToBXDVector(currentOccurrence.Transformation.Translation); outputNode.Rotation = Utilities.QuaternionFromMatrix(currentOccurrence.Transformation); if (!exportedMeshes.Contains(currentOccurrence.ReferencedDocumentDescriptor.FullDocumentName)) { surfaceExporter.Reset(); surfaceExporter.Export(((PartDocument)currentOccurrence.ReferencedDocumentDescriptor.ReferencedDocument).ComponentDefinition, false, true); BXDAMesh.BXDASubMesh outputMesh = surfaceExporter.GetOutput().meshes.First(); exportedMeshes.Add(currentOccurrence.ReferencedDocumentDescriptor.FullDocumentName); fieldDefinition.AddSubMesh(outputMesh); } outputNode.SubMeshID = exportedMeshes.IndexOf(currentOccurrence.ReferencedDocumentDescriptor.FullDocumentName); //ComponentPropertiesTabPage componentProperties = Program.MAINWINDOW.GetPropertySetsTabControl().GetParentTabPage(currentOccurrence.Name); string componentProperties = LegacyInterchange.GetCompFromDictionary(currentOccurrence.Name); if (componentProperties != null) { outputNode.PropertySetID = componentProperties /*.Name*/; PropertySet propertySet = fieldDefinition.GetPropertySets()[outputNode.PropertySetID]; if (propertySet.Collider.CollisionType == PropertySet.PropertySetCollider.PropertySetCollisionType.MESH && ((PropertySet.MeshCollider)propertySet.Collider).Convex) { if (!exportedColliders.Contains(currentOccurrence.ReferencedDocumentDescriptor.FullDocumentName)) { exportedColliders.Add(currentOccurrence.ReferencedDocumentDescriptor.FullDocumentName); var test = fieldDefinition.GetSubMesh(outputNode.SubMeshID); fieldDefinition.AddCollisionMesh(ConvexHullCalculator.GetHull(fieldDefinition.GetSubMesh(outputNode.SubMeshID))); } outputNode.CollisionMeshID = exportedColliders.IndexOf(currentOccurrence.ReferencedDocumentDescriptor.FullDocumentName); } } pathBuilder.Clear(); foreach (ComponentOccurrence co in currentOccurrence.OccurrencePath) { pathBuilder.Append(co.Name + "/"); } pathBuilder.Length--; fieldDefinition.NodeGroup[pathBuilder.ToString()] = outputNode; } currentOccurrenceID++; } exporter.ReportProgress(100, "Export Successful!"); fieldDefinition.GetMeshOutput().WriteToFile(filePathTextBox.Text + "\\mesh.bxda"); BXDFProperties.WriteProperties(filePathTextBox.Text + "\\definition.bxdf", fieldDefinition); // Use the commented code below for debugging. /** / * string result; * FieldDefinition readDefinition = BXDFProperties.ReadProperties(filePathTextBox.Text + "\\definition.bxdf", out result); * MessageBox.Show(result); * /**/ }
internal OpIsNull(FieldNode field) : base(field, null) { }
public void AddExtend(TypeName target, FieldNode field) { if (!Extends.ContainsKey(target)) Extends[target] = new List<FieldNode>(); Extends[target].Add(field); }
internal OpContains(FieldNode field, ValueNode valueNode) : base(field, valueNode) { }
internal CAMLOpIsNull(FieldNode field) : base(field) { }