Esempio n. 1
0
        private static Node CreateSchemaNode(Type type, string name, LogicalType logicalTypeOverride, int length, int precision, int scale)
        {
            if (Primitives.TryGetValue(type, out var p))
            {
                var entry = GetEntry(type, logicalTypeOverride, p.Entries);
                return(new PrimitiveNode(name, p.Repetition, entry.PhysicalType, entry.LogicalType, length, precision, scale));
            }

            if (type.IsArray)
            {
                var item = CreateSchemaNode(type.GetElementType(), "item", logicalTypeOverride, length, precision, scale);
                var list = new GroupNode("list", Repetition.Repeated, new[] { item });

                try
                {
                    return(new GroupNode(name, Repetition.Optional, new[] { list }, LogicalType.List));
                }
                finally
                {
                    list.Dispose();
                    item.Dispose();
                }
            }

            throw new ArgumentException($"unsupported logical type {type}");
        }
Esempio n. 2
0
        private static Node CreateSchemaNode(LogicalTypeFactory logicalTypeFactory, Type type, string name, LogicalType?logicalTypeOverride, int length)
        {
            if (logicalTypeFactory.TryGetParquetTypes(type, out var p))
            {
                var entry = logicalTypeFactory.GetTypesOverride(logicalTypeOverride, p.logicalType, p.physicalType);
                return(new PrimitiveNode(name, p.repetition, entry.logicalType, entry.physicalType, length));
            }

            if (type.IsArray)
            {
                var item = CreateSchemaNode(logicalTypeFactory, type.GetElementType(), "item", logicalTypeOverride, length);
                var list = new GroupNode("list", Repetition.Repeated, new[] { item });

                try
                {
                    return(new GroupNode(name, Repetition.Optional, new[] { list }, LogicalType.List()));
                }
                finally
                {
                    list.Dispose();
                    item.Dispose();
                }
            }

            throw new ArgumentException($"unsupported logical type {type}");
        }
Esempio n. 3
0
 private void _LoadFloatWindows(XElement ele)
 {
     foreach (var item in ele.Elements())
     {
         var node = item.Element("Panel");
         if (node != null)
         {
             var panelNode = new PanelNode(null);
             panelNode.Load(node);
             panelNode.ApplyLayout(this, true);
             panelNode.Dispose();
         }
         else
         {
             node = item.Element("Group");
             var groupNode = new GroupNode(null);
             groupNode.Load(node);
             groupNode.ApplyLayout(this, true);
             groupNode.Dispose();
         }
     }
 }