Example #1
0
        public void ImportData(DataFile file, bool isReimport = false)
        {
            DataFile export = null;

            if (!isReimport && context.DatabaseExists(file.database))
            {
                export = DefaultDataExport(file.database, true);
            }

            IDataLoader loader = DataLoaderFactory.CreateDataLoader(file.dataType, context);

            loader.Import(file);

            if (export == null)
            {
                return;
            }

            List <DataFile> dataFiles = new List <DataFile>()
            {
                export
            };

            if (export.dataType == DataType.Archive)
            {
                dataFiles = ExtractZip(export);
            }

            for (int i = 0; i < dataFiles.Count; i++)
            {
                ImportData(dataFiles[i], true);                 //recursive reimport
            }
        }