コード例 #1
0
        private static FileState ParseFile(File3dm file, DataStore store, RvcVersion version, out ChangeSet changes)
        {
            FileState             state           = null;
            List <IFileDataTable> parsedTableList = new List <IFileDataTable>();
            //opening the store, and the file and comparing the contents
            List <Type>        memberTypes;
            List <string>      tableNames;
            List <IEnumerable> tables3dm   = GetAllTables(file, out memberTypes, out tableNames);
            ChangeSet          fileChanges = new ChangeSet();

            for (int i = 0; i < tables3dm.Count; i++)
            {
                ChangeSet      tableChanges;
                IFileDataTable parsedTable = TableUtil.ParseTableData(tables3dm[i], tableNames[i], memberTypes[i], version, store, out tableChanges);
                parsedTableList.Add(parsedTable);
                fileChanges = ChangeSet.Merge(fileChanges, tableChanges);
            }

            //populating the file state
            state = new FileState(store, version.AddDownStreamVersion(fileChanges));
            foreach (var table in parsedTableList)
            {
                state.Tables.Add(table);
            }
            changes = fileChanges;
            return(state);
        }
コード例 #2
0
        public static List <IEnumerable> GetAllTables(File3dm file, out List <Type> memberTypes, out List <string> names)
        {
            var props = typeof(File3dm).GetProperties();
            List <IEnumerable> tables = new List <IEnumerable>();

            memberTypes = new List <Type>();
            names       = new List <string>();
            foreach (var p in props)
            {
                Type memberType;
                var  match = TableUtil.IsFile3dmTableType(p.PropertyType, out memberType);
                if (!match)
                {
                    continue;
                }
                memberTypes.Add(memberType);
                names.Add(p.Name);
                var table = p.GetValue(file);
                tables.Add((IEnumerable)table);
            }

            return(tables);
        }