示例#1
0
        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));
            }
        }
示例#2
0
        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));
            }
        }
示例#3
0
 public void Copy(DynamicValue reference)
 {
     value     = reference.value;
     valueType = reference.valueType;
     isArray   = reference.isArray;
     data      = reference.data;
     CopyUtility.CopyTo(reference.objectValue, ref objectValue);
 }
示例#4
0
        protected override void InitializeSources()
        {
            sourcesIndex = 0;
            CopyUtility.CopyTo(originalSettings.Delays, ref settings.Delays);

            if (originalSettings.Sources.Count > 0)
            {
                AddSource(originalSettings.Sources[sourcesIndex++]);
            }
        }
示例#5
0
        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));
            }
        }
示例#6
0
文件: Update.cs 项目: afrog33k/eAd
        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);
            //}
        }