Esempio n. 1
0
        public void SetSchema(SourceTable source)
        {
            if (description.format == MetaTableFormatType.horizontal)
            {
                var rows = source.GetContentByRows();

                if (rows.Count <= description.index_propertyID)
                {
                    return;
                }
                var propertyList = GetPropertyNames(rows, description.index_propertyID);

                for (int i = 0;
                     //description.sourceDescription.valueZone.x;
                     i < propertyList.Count; i++) //description.sourceDescription.valueZone.width + description.sourceDescription.valueZone.x; i++)
                {
                    var property = properties.Add(propertyList[i], i);
                }
            }
            else if (description.format == MetaTableFormatType.vertical)
            {
                List <List <string> > columns = source.GetContentByColumns();


                if (columns.Count <= description.index_propertyID)
                {
                    return;
                }

                var propertyList = GetPropertyNames(columns, description.index_propertyID);

                for (int i = 0;
                     // description.sourceDescription.valueZone.y;
                     i < propertyList.Count; i++) // description.sourceDescription.valueZone.height + description.sourceDescription.valueZone.y; i++)
                {
                    var property = properties.Add(propertyList[i], i);
                }
            }

            if (description.index_entryID < 0)
            {
                var property = properties.Add(description.entryIDPropertyName, description.index_entryID);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Transforms the scraped content (<see cref="SourceTable"/>) into entries
        /// </summary>
        /// <param name="source">The source.</param>
        public void SetEntries(SourceTable source)
        {
            List <List <string> > data = null;
            Int32 Skip = description.EntrySkipCount;

            if (description.format == MetaTableFormatType.horizontal)
            {
                data = source.GetContentByRows();    //if (i2 >= description.sourceDescription.valueZone.y)
            }
            else if (description.format == MetaTableFormatType.vertical)
            {
                data = source.GetContentByColumns(); //for (int i = description.sourceDescription.valueZone.x; i < description.sourceDescription.valueZone.width + description.sourceDescription.valueZone.x; i++)
            }

            for (int i = Skip; i < data.Count; i++)
            {
                if (i != description.index_propertyID)
                {
                    entries.CreateEntry(data[i], true);
                }
            }
        }