示例#1
0
        public static ExportAdapter GetExporter(string fullName, params object[] exportParams)
        {
            if (string.IsNullOrEmpty(fullName))
            {
                return(null);
            }
            Type exporter = TransferContainer.Instance().GetExporter(fullName);

            if (exporter == null)
            {
                return(null);
            }
            if (exportParams != null && exportParams.Length > 0)
            {
                return(Activator.CreateInstance(exporter, exportParams) as ExportAdapter);
            }
            return(Activator.CreateInstance(exporter) as ExportAdapter);
        }
示例#2
0
        public static Dictionary <string, string> GetImportAdapters(Target importTo, string sourceName)
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            DataRow[] importerList = TransferContainer.Instance().GetImporterList(sourceName, importTo.Name);
            if (importerList == null || importerList.Length == 0)
            {
                return(dictionary);
            }
            string value = null;
            int    num   = 0;

            do
            {
                Version v = new Version(importerList[num]["importToVersion"].ToString());
                if (v <= importTo.Version)
                {
                    value = importerList[num]["importToVersion"].ToString();
                }
                num++;
            }while (string.IsNullOrEmpty(value) && num < importerList.Length);
            if (!string.IsNullOrEmpty(value))
            {
                DataRow[] array = importerList;
                for (int i = 0; i < array.Length; i++)
                {
                    DataRow dataRow = array[i];
                    string  text    = dataRow["importToVersion"].ToString();
                    if (text.Equals(value))
                    {
                        dictionary.Add(dataRow["fullName"].ToString(), dataRow["sourceName"].ToString() + dataRow["sourceVersion"].ToString());
                    }
                }
            }
            return(dictionary);
        }