/// <summary> /// Copies the data for this field from one row of the input into the target object. /// </summary> /// <param name="target"></param> /// <param name="row"></param> /// <param name="rowNbr"></param> internal void Import(T target, ImportRecord row, int rowNbr) { if (TargetProperty == null) { return; } try { object val; if (ConvertFunc == null) { val = row.GetValue(FieldName, TargetProperty.PropertyType); } else { val = ConvertFunc(row.GetValue(FieldName)); val = ImportRecord.Convert(val, TargetProperty.PropertyType); } if (ImportTarget.ConvertFunc != null) { val = ImportTarget.ConvertFunc(val); } TargetProperty.SetValue(target, val); } catch (Exception ex) { throw new ImportException($"There was a problem importing the data for {FieldName} at row {rowNbr}", ex); } }
public override void CreateBulkInsertTask(string table, EnumerableDataReader reader, ImportTarget target) { BulkCopyTask task = new BulkCopyTask(new MySqlBulkInserter(Config.Provider.ConnectionString, table, target.Schema), table, reader, target.Name, Config.BatchSize, target.Schema); Jobs.Find(j => j.Tag == table).Tasks.Add(task); }
public override void CreateBulkInsertTask(string table, EnumerableDataReader reader, ImportTarget target) { BulkCopyTask task = new BulkCopyTask(new SQLiteBulkInserter(_targetPath, target.Schema, table), table, reader, target.Name, Config.BatchSize, target.Schema); task.PostProcess += PostProcess; // when the task is complete, merge into main file _locks[task.Schema] = new object(); Jobs.Find(j => j.Tag == target.Schema).Tasks.Add(task); }
private ImportDebugInformation Clone(ImportDebugInformation import, MethodDefinition context) { var importDebugInfo = new ImportDebugInformation(); if (import.HasCustomDebugInformations) { importDebugInfo.CustomDebugInformations.AddRange(import.CustomDebugInformations); } if (import.Parent != null) { importDebugInfo.Parent = Clone(import.Parent, context); } if (import.HasTargets) { foreach (var importTarget in import.Targets) { var targetCopy = new ImportTarget(importTarget.Kind); if (importTarget.Alias != null) { targetCopy.Alias = importTarget.Alias; } if (importTarget.Namespace != null) { targetCopy.Namespace = importTarget.Namespace; } if (importTarget.AssemblyReference != null) { if (_repackContext.MergedAssemblies.Any(x => x.Name.Name == importTarget.AssemblyReference.Name)) { continue; } targetCopy.AssemblyReference = (AssemblyNameReference)_repackContext.PlatformFixer.FixPlatformVersion(importTarget.AssemblyReference); } if (importTarget.AssemblyReference != null) { targetCopy.AssemblyReference = targetCopy.AssemblyReference; } if (importTarget.Type != null) { targetCopy.Type = Import(importTarget.Type, context); } importDebugInfo.Targets.Add(targetCopy); } } return(importDebugInfo); }
public static List <ImportTarget> GetTargets(string source, IEnumerable <string> unparsed) { List <ImportTarget> targets = new List <ImportTarget>(); foreach (string arg in unparsed) { ImportTarget site = GetSite(source, arg); if (site != null) { targets.Add(site); } } return(targets); }
public override void CreateBulkInsertTask(string table, EnumerableDataReader reader, ImportTarget target) { BulkCopyTask task = new BulkCopyTask(new MsSqlBulkCopy(Config.Provider.ConnectionString, SqlBulkCopyOptions.TableLock), table, reader, target.Name, Config.BatchSize, target.Schema); Jobs.Find(j => j.Tag == table).Tasks.Add(task); }
static ImportDebugInformation GetImport(PdbScope scope, ModuleDefinition module) { if (scope.usedNamespaces.IsNullOrEmpty()) { return(null); } var import = new ImportDebugInformation(); foreach (var used_namespace in scope.usedNamespaces) { if (string.IsNullOrEmpty(used_namespace)) { continue; } ImportTarget target = null; var value = used_namespace.Substring(1); switch (used_namespace [0]) { case 'U': target = new ImportTarget(ImportTargetKind.ImportNamespace) { @namespace = value }; break; case 'T': { var type = TypeParser.ParseType(module, value); if (type != null) { target = new ImportTarget(ImportTargetKind.ImportType) { type = type } } ; break; } case 'A': var index = used_namespace.IndexOf(' '); if (index < 0) { target = new ImportTarget(ImportTargetKind.ImportNamespace) { @namespace = used_namespace }; break; } var alias_value = used_namespace.Substring(1, index - 1); var alias_target_value = used_namespace.Substring(index + 2); switch (used_namespace [index + 1]) { case 'U': target = new ImportTarget(ImportTargetKind.DefineNamespaceAlias) { alias = alias_value, @namespace = alias_target_value }; break; case 'T': var type = TypeParser.ParseType(module, alias_target_value); if (type != null) { target = new ImportTarget(ImportTargetKind.DefineTypeAlias) { alias = alias_value, type = type } } ; break; } break; case '*': target = new ImportTarget(ImportTargetKind.ImportNamespace) { @namespace = value }; break; case '@': if (!value.StartsWith("P:")) { continue; } target = new ImportTarget(ImportTargetKind.ImportNamespace) { @namespace = value.Substring(2) }; break; } if (target != null) { import.Targets.Add(target); } } return(import); } void ReadSequencePoints(PdbFunction function, MethodDebugInformation info) { if (function.lines == null) { return; } info.sequence_points = new Collection <SequencePoint> (); foreach (PdbLines lines in function.lines) { ReadLines(lines, info); } } void ReadLines(PdbLines lines, MethodDebugInformation info) { var document = GetDocument(lines.file); foreach (var line in lines.lines) { ReadLine(line, document, info); } }
private void listView1_AfterLabelEdit(object sender, LabelEditEventArgs e) { ImportTarget target = (ImportTarget)listView1.Items[e.Item].Tag; target.Schema = e.Label; }
public void CompleteCreation(ImportTarget target) { ReachedTarget |= target; }
public void CompleteModeration(ImportTarget target) { ModerationCompletedTarget |= target; }
private void AddFeatureBasedMapDataToMapDataCollection(FeatureBasedMapData importedMapData) { ImportTarget.Add(RemovableMapDataConverter.FromFeatureBasedMapData(importedMapData)); }