static IPoolSetter GetSetter(object value, FieldInfo field, HashSet <object> toIgnore) { if (value == null) { return(new PoolSetter(field, value)); } else if (toIgnore.Contains(value)) { throw new InitializationCycleException(field); } var copier = CopyUtility.GetCopier(value.GetType()); if (copier != null) { return(new PoolCopierSetter(copier, field, value)); } else if (value is IList) { return(new PoolArraySetter(field, value.GetType(), GetElementSetters((IList)value, field, toIgnore))); } else if (field.IsDefined(typeof(InitializeContentAttribute), true)) { if (!(value is ValueType)) { toIgnore.Add(value); } return(new PoolContentSetter(field, value.GetType(), GetSetters(value, toIgnore))); } else { return(new PoolSetter(field, value)); } }
static IPoolElementSetter GetElementSetter(object element, FieldInfo field, HashSet <object> toIgnore) { if (element == null) { return(new PoolElementSetter(element)); } else if (toIgnore.Contains(element)) { throw new InitializationCycleException(field); } var copier = CopyUtility.GetCopier(element.GetType()); if (copier != null) { return(new PoolElementCopierSetter(copier, element)); } else if (field.IsDefined(typeof(InitializeContentAttribute), true)) { if (!(element is ValueType)) { toIgnore.Add(element); } return(new PoolElementContentSetter(element.GetType(), GetSetters(element, toIgnore))); } else { return(new PoolElementSetter(element)); } }
public void Copy(DynamicValue reference) { value = reference.value; valueType = reference.valueType; isArray = reference.isArray; data = reference.data; CopyUtility.CopyTo(reference.objectValue, ref objectValue); }
protected override void InitializeSources() { sourcesIndex = 0; CopyUtility.CopyTo(originalSettings.Delays, ref settings.Delays); if (originalSettings.Sources.Count > 0) { AddSource(originalSettings.Sources[sourcesIndex++]); } }
public static IFieldInitializer GetPoolInitializer(object instance) { var copier = CopyUtility.GetCopier(instance.GetType()); if (copier == null) { return(new FieldInitializer(instance)); } else { return(new CopierFieldInitializer(copier, instance)); } }
private void MoveFiles() { // var di = new DirectoryInfo(_tempDownloadFolder); CopyUtility.CopyAllFiles(_tempDownloadFolder, _destinationFolder, true, this); SetLabel(line1, "All files moved..."); //FileInfo[] files = di.GetFiles(); //foreach (FileInfo fi in files) //{ // if (fi.Name != _downloadFile) // File.Copy(_tempDownloadFolder + fi.Name, _destinationFolder + fi.Name, true); //} }