private void Init() { Attributes = System.IO.FileAttributes.Directory; Childs = new BlockingList <VFile> { new PlainText("Идет загрузка.txt") }; }
public GenericObjectPool(IPooledObjectFactory <T> factory, GenericObjectPoolConfig genericObjectPoolConfig) : base(genericObjectPoolConfig) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } this._factory = factory; this._idleObjects = new BlockingList <IPooledObject <T> >(BorrowStrategy.LIFO); this.SetConfig(genericObjectPoolConfig); StartEvictor(genericObjectPoolConfig.TimeBetweenEvictionRunsMillis); }
private void GroupFile() { if (Childs.Count <= 500) { return; } const int maxFile = 500; /*if (Childs.First().GetType() == typeof(Folder)) * { * maxFile = 100; * } * else if (Childs.Count < maxFile) * { * return; * }*/ BlockingList <VFile> replaceChilds = new BlockingList <VFile>(); List <VFile> copy = Childs.Select(item => item).ToList(); // clone list copy.Sort((a, b) => string.Compare(a.FileName, b.FileName, StringComparison.Ordinal)); for (var i = 0; i <= (copy.Count / maxFile); i++) { var residue = copy.Count - (i * maxFile); // остаток residue = residue < maxFile ? residue : maxFile; IList <VFile> tmp = copy.GetRange(i * maxFile, residue); var folderName = VFile.ClearName(tmp[0].FileName, false).Substring(0, 1) + ".." + VFile.ClearName(tmp[residue - 1].FileName, false).Substring(0, 1); var fNode = new Folder(folderName); foreach (VFile curFile in tmp) { fNode.Childs.Add(curFile); } fNode.IsLoaded = true; replaceChilds.Add(fNode); } Childs = replaceChilds; }