Пример #1
0
        public static void Unpack(Level level, BackgroundTask worker, bool insert)
        {
            SqlTrans transaction = new SqlTrans();

            Assembly[] assemblies = SysExtension.GetInstalledAssemblies();

            int i = 0;
            foreach (Assembly asm in assemblies)
            {
                int progress = (int)(i * 100.0 / assemblies.Length);
                worker.SetProgress(progress, 0, asm.GetName().Name);

                Unpack(level, asm, worker, transaction, insert);

                i++;
            }

            transaction.Commit();

            return;
        }
Пример #2
0
        private static void Unpack(Level level, Assembly asm, BackgroundTask worker, SqlTrans transaction, bool insert)
        {
            foreach (Type type in asm.GetExportedTypes())
            {
                if (type.HasInterface<IPacking>() && type != typeof(BasePackage<>))
                {
                    IPacking packing = (IPacking)Activator.CreateInstance(type);
                    if (level == packing.Level)
                    {
                        worker.SetProgress(0, string.Format("Unpacking #record={0} of table [{1}].", packing.Count, packing.TableName));
                        packing.Unpack(worker, transaction, insert);
                    }
                }
            }

            return;
        }